1

I set ServerLimt to 15 and MaxClients to 8, but every now and then I see 150 Apache processes. How come?

I have Apache/2.4.7 (Ubuntu), MPM: prefork

StartServers           1
MinSpareServers        1
MaxSpareServers        2
Serverlimit           15
MaxClients             8
MaxRequestsPerChild   50

Soon after I start my server, I can see 11 Apache processes: one parent and 10 child processes. Based on this, I assume 8 of the 10 child processes are because of the "MaxClients" setting, and 2 others are spawned because I set "MaxSpareServers=2".

Now and then, the number of processes goes a little beyond 15. I don't understand how this can happen is Serverlimit is 15. But, the real problem is that occasionally the number of processes shoots up to about 150, exhausting RAM.

The documentation says "With the prefork MPM, use this directive only if you need to set MaxClients higher than 256 (default). Do not set the value of this directive any higher than what you might want to set MaxClients to."

The first sentence seems to say I should not touch it, but the second seems to suggest I should bring it down to match MaxClients.

Bottomline: If Serverlimit won't work, how else can I set a hard limit on the number of Apache processes.

  • 1
    Is this perhaps a duplicate? serverfault.com/questions/244750/… – Ryan Babchishin Oct 25 '15 at 21:52
  • I tested the same configuration on a virtual machine (Ubuntu 14.04 Apache 2.4.7). I just works fine. How are you watching the number of processes (top, ps, lsof)? Have you tried to use ab to stress the server and trigger the problem? – Mauricio López Nov 4 '15 at 15:40
1
+50

Are you sure apache is reading the right configuration file and / or you're using the prefork mpm?

Check the actual configuration (expecially mpm and the ones you wrote) with:

apache2ctl -S

In case post them here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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