7

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)

1 Answer 1

4

I'm not sure, but your ps output reminded me much of Linux 2.4 - threads used to appear as processes on ps until the move from Linux Threads to the Native Posix Threads Library.

This quote from this thread seems to confirm my suspicion:

Under GNU/kFreeBSD threads are process clones, similarly as under linux 2.4 series

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:

This directive sets the number of threads created by each child process. The child creates these threads at startup and never creates more. (...) The default value for ThreadsPerChild is 64 when used with mpm_winnt and 25 when used with the others.

http://httpd.apache.org/docs/2.0/mod/mpm_common.html#threadsperchild

1
  • This is the BSD kernel so that's probably exactly it. Thank you!!
    – Josh
    May 21, 2011 at 22:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .