httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@raleigh.ibm.com>
Subject [Announce] Mod_cgid.c
Date Tue, 16 Nov 1999 14:35:11 GMT

I have posted mod_cgid.c to this list multiple times before.  It has
always met with some reluctance, usually because of some design flaw.  I
have updated this module for Apache 2.0, and I believe I have fixed all of
the design issues.  I would like to include this module in Apache 2.0.

The module can be found at:

http://www.ntrnet.net/~rbb/apache/mod_cgid.c

Reasons for including the module:
  On some versions of Unix, forking a threaded process actually creates
all of the threads and then kills all but one thread.  This is
understandably resource intensive.  This kills CGI performance on a
threaded Unix server.  Some Unixes provide a "fast fork" function, which
supposedly forks a process with only one thread.  Most of these
implementations aren't very good, and they and much slower than forking a
single threaded process.

Design of the module:
In the init phase, we fork a CGI Deamon (cgid  :-), which sets up a Unix
domain socket, and accepts on it.  When a CGI request comes in, the server
connects to that socket, and sends over enough infomration to start the
CGI process.  The cgid wakes up from accept, and immediately forks a new
process, then closes the accepted sockte, and goes back into accept (a
VERY tight loop, to avoid potential problems).  The CGI process reads the
data sent by the web server, and dups it's STDIN and STDOUT to the new
socket.  STDERR is dupped to either the error log, or the file specified
in the ScriptLog directive.  The CGI then exec's the requested program.
>From there, CGI processing proceeds as it normally would.  The CGID
process is a reliable process on platforms that support them, although
this needs to be tested MUCH better.

I expect that when we configure Apache 2.0, we will either compile mod_cgi
or mod_cgid, depending on which MPM is chosen, and which platform we are
compiling for.  For example, this is not an issue on Linux, because
threads and processes are the same thing, and when Linux forks, it only
forks one thread.  It is an issue on Sun, and AIX (to the best of
my knowledge) though, so mod_cgid would be used on those platforms.  Other
platforms would need to be tested to determine if they recieve a
performance boost by using mod_cgid.

Thoughts?

Ryan

_______________________________________________________________________
Ryan Bloom		rbb@raleigh.ibm.com
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	


Mime
View raw message