NCSA HTTPd 1.4 Pre-Forking Model

I originally looked into the performance problems when we started having problems with www.acm.uiuc.edu which hosts Rob's Multimedia Lab on its RS/6000 360. The decision we made was to have a single process pre-fork to spawn several children. The parent selects() on the main socket, and after accepting connections, it passes it to one of the spawned children.

NCSA HTTPd 1.4 supports both SYSV and BSD file descriptor passing, as well as a NO_PASS mode for systems which don't support file descriptor passing. One such popular system is Linux, the free unix operating system. Several Linux developers are rumoured to be working on fixing this deficiency.

I later had a brain storm about possibly having multiple processes fork and then all sit on accept() on the main socket, but this behaviour is not documented in the socket description, and different OS's handle this in different fashions. We decided to stick with the file descriptor passing method already implemented.

Some Notes: Not all of the previously supported systems were available to test file descriptor passing. The default behaviour is to compile these systems without it. It is known to be supported under SunOS4, Solaris2, Irix, HP-UX, AIX, Ultrix, OSF/1, NeXT, NetBSD, and SCO SVR3.2. In order to compile with file descriptor passing, you must define FD_BSD or FD_SYSV in the configuration section for your system in src/httpd.h. Even if your system defines SYSV instead of BSD, you will probably use FD_BSD (As most of the above systems do.) If you do add this feature to another system, please mail the information to httpd@ncsa.uiuc.edu.

Also, if you are a larger server, you need to watch out for the limit on the number of open files allowed per process, and the number of processes allowed per user. The server maintains a pipe to each child to pass the file descriptors, so you need at least 4+MaxServers file descriptors allowed, and more to allow servers above MaxServers. Systems like SunOS 4, under the GENERIC compile, have a maximum of 64. Some systems, like Solaris 2 allow the system administrator to set the maximum. The maximum number of processes per user is a problem since HTTPd setuids to the user you specify in httpd.conf. If user nobody is only allowed 40 processes (the default under AIX 3.2.x), and you have more than 40 children (or around) the child cannot run any CGI scripts. AIX allows you to change this value via SMIT.

Brandon


[Back] Return to the Upgrade page.
NCSA HTTPd Development Team / httpd@ncsa.uiuc.edu / Last Modified 9-08-95