Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am on Debian 6 LAMP with apache mpm_prefork

I have

Timeout 20
KeepAlive On
MaxKeepAliveRequests 80
KeepAliveTimeout 2

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    ServerLimit      500
    MaxClients            500
    MaxRequestsPerChild   1500

with 4GB of RAM. The problem is Apache2 starts too many process. Whenever I do top I see most of time only 1 running, while the number of apache2 process sleeping grows over time (now at 437 processes and counting)

Can I know Why apache2 starts new process instead to use the one already opened? And how can i tell to apache to don't open so many process?


share|improve this question
up vote 4 down vote accepted

You've told Apache that you want to be able to service 500 clients simultaneously and have a hard limit on the client process pool of 500.

As Apache receives requests it will start to expand its process pool until it gets to near your limit.

Because you're using a preforking server, each process only handles a single request thread, so Apache needs to maintain a large number of sleeping processes in order to handle up to the number of simultaneous clients you've specified. These eat a lot of memory.

You can either switch to a threading MPM model, reduce the value of MaxClients or increase the amount of RAM. See both and

share|improve this answer
thanks for the reply +1. But I heard with PHP i can only use prefork (it was installed automatically with apt-get) anyway I will try to lower maxclients and serverlimit to 400 – dynamic Mar 22 '11 at 11:47
PHP recommend to use a preforked MPM model. Aside from non-threadsafe PHP modules and a general sense of "We like separate processes because threads are difficult", I'm not sure really why this is. Depending on how popular your site is, I'd set the apache settings to be fairly conservative and then monitor closely to see how performance is affected by load. – growse Mar 22 '11 at 12:17
The thing I don't get is: Why apache2 opens new process if there are shitload in sleeping! =/ that's what i don't get – dynamic Mar 22 '11 at 12:23
@growse: AWW maybe i found my problem. While moving my website to the new server i forgot to load mod_expires so everytime users moved in my website had to request for each image/css/js a new request. That caused so many more connections to handle by apache2. I now activated mod_expires i will monitor the situtation – dynamic Mar 23 '11 at 20:21
Ah, that wouldn't help :) People often forget that loading a modern web page can result in tens of connections being created. On a prefork model, this will bump the process count significantly. – growse Mar 23 '11 at 20:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.