Hello,
Our environment: CentOS 5, Apache 2.2 from 2.2.3 from CentOS packages.
Our dev manager asked me to configure Apache to run only one process
(multiple threads) due to limitations of the C++ code we link into it (via
Perl+SWIG).
I wasn't 100% sure which MPM we use so I configured both the prefork MPM and
worker MPM as follows (was in a hurry):
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 1
ServerLimit 1
MaxClients 1
MaxRequestsPerChild 4000
</IfModule>
<IfModule worker.c>
StartServers 1
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
ServerLimit 1
MaxClients 1
</IfModule>
I restarted Apache and pstree showed something which seemed to confirm my
setup:
httpd───httpd───61*[{httpd}]
(i.e. a grand parent, a parent and 61 threads).
Also the dev manager confirmed that we only use one pid (I added output of
"$$" in the log from the perl glue code).
The next day I sat down to investigate and understand the configuration so
it can be documented and become part of our platform setup.
As far as I can tell the above shouldn't have worked - all the signs show
that CentOS's Apache should use the prefork MPM and that this MPM doesn't
support multi-threading:
1. The program being executed is /usr/sbin/httpd and NOT
/usr/sbin/httpd.worker
2. running "/usr/sbin/httpd -l" gives:
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
3. The /etc/sysconfig/httpd file does NOT set the HTTPD variable to point to
the httpd.worker, the default is /usr/sbin/httpd
4. the server's error log includes the following lines upon startup:
[info] Server built: Nov 10 2007 12:44:14
[debug] prefork.c(991): AcceptMutex: sysvsem (default: sysvsem)
[error] server reached MaxClients setting, consider raising the MaxClients
setting
All the docs about the prefork MPM stress that it's not multi-threaded.
So what am I missing? Does httpd somehow switch to the worker MPM behind my
back or are the docs for 2.2 out of date or what?
Thanks,
--Amos