I have a Debian 6.0.1 machine running GNU/kFreeBSD 8.1-1-amd64 and Apache. I installed apache2-mpm-worker
using apt-get
, and my apache2.conf
file contains:
<IfModule mpm_prefork_module>
StartServers 4
MinSpareServers 2
MaxSpareServers 5
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 1
MinSpareThreads 2
MaxSpareThreads 20
ThreadLimit 64
ThreadsPerChild 20
MaxClients 100
MaxRequestsPerChild 400
</IfModule>
So I should see only a couple Apache processes running. However, it looks more like I am running prefork, because instead of many threads i appear to have many processes:
root@garrison:/# ps awwwwx | grep apache
78438 ? S+ 0:00 grep apache
78424 ? S 0:00 /usr/sbin/apache2 -k start
78423 ? S 0:00 /usr/sbin/apache2 -k start
78422 ? S 0:00 /usr/sbin/apache2 -k start
78421 ? S 0:00 /usr/sbin/apache2 -k start
78420 ? S 0:00 /usr/sbin/apache2 -k start
78419 ? S 0:00 /usr/sbin/apache2 -k start
78418 ? S 0:00 /usr/sbin/apache2 -k start
78417 ? S 0:00 /usr/sbin/apache2 -k start
78416 ? S 0:00 /usr/sbin/apache2 -k start
78415 ? S 0:00 /usr/sbin/apache2 -k start
78414 ? S 0:00 /usr/sbin/apache2 -k start
78413 ? S 0:00 /usr/sbin/apache2 -k start
78412 ? S 0:00 /usr/sbin/apache2 -k start
78411 ? S 0:00 /usr/sbin/apache2 -k start
78410 ? S 0:00 /usr/sbin/apache2 -k start
78409 ? S 0:00 /usr/sbin/apache2 -k start
78408 ? S 0:00 /usr/sbin/apache2 -k start
78407 ? S 0:00 /usr/sbin/apache2 -k start
78406 ? S 0:00 /usr/sbin/apache2 -k start
78405 ? S 0:00 /usr/sbin/apache2 -k start
78404 ? S 0:00 /usr/sbin/apache2 -k start
78402 ? S 0:00 /usr/sbin/apache2 -k start
78401 ? S 0:00 /usr/sbin/apache2 -k start
78400 ? S 0:00 /usr/sbin/apache2 -k start
78397 ? Ss 0:00 /usr/sbin/apache2 -k start
Yet Apache clearly has the worker module installed, not the prefork module:
root@garrison:/HostRAID/netboot/IntelNetboot.nbi# /usr/sbin/apache2 -l
Compiled in modules:
core.c
mod_log_config.c
mod_logio.c
worker.c
http_core.c
mod_so.c
What gives? Why do I have so many apache2
processes? This server is under no load. (That is, no http requests)
I'm not sure, but your
ps
output reminded me much of Linux 2.4 - threads used to appear as processes onps
until the move from Linux Threads to the Native Posix Threads Library.This quote from this thread seems to confirm my suspicion:
If this is the case these wouldn't mean worker is malfunctioning. It isn't forking - those are threads you're seeing. Apache docs on
ThreadsPerChild
:http://httpd.apache.org/docs/2.0/mod/mpm_common.html#threadsperchild