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'm trying to optimize our web servers to handle as much connections as possible. I read a many posts and the Apache notes. I'm trying to understand which value should I choose for MaxRequestsPerChild.

At first, I've tried setting it to 4,000, but the server had difficulties handling many request, so I've started raising it. At the moment my setting are:

<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  40000

After setting the MaxRequestsPerChild to 40,000 the server managed to handle more connections while not using more memory/cpu.

Can anyone tell me please whether this value is too high or it's ok to have such an high value?


OS info:

[root@web06 ~]# uname -a
Linux web 2.6.18-164.el5PAE #1 SMP Thu Sep 3 04:10:44 EDT 2009 i686 i686 i386 GNU/Linux
[root@web06 ~]# free
             total       used       free     shared    buffers     cached
Mem:       3814660    3502968     311692          0     144368    2970468
-/+ buffers/cache:     388132    3426528
Swap:      5210104          0    5210104
share|improve this question
up vote 6 down vote accepted

MaxRequestsPerChild is really only useful to limit the amount of memory leakage over time when running dynamic scripts. If you are just serving static content or very small/simple scripts then you can probably set it to 0 or very high without much effect. If you are running larger/complex scripts then setting it 0/high will result in your Apache processes consuming more and more memory. Exactly how much more depends on your specific application.

On the other side, setting it very low may actually result in slightly more CPU usage as the Apache processes are constantly being restarted.

I would do a simple test to see how much memory your processes can use. Set MaxRequestsPerChild to 0 and restart Apache. Test load a few pages and see what the initial size of the Apache processes are using top. Check again after a few hours/days/weeks (depending on your application and page views) and see how it grows. If it doesn't grow very much then a 0 or very large value for MaxRequestsPerChild should be fine.

If you have a set maximum size for your Apache processes (i.e., you want them to be 50MB or less) then you can do the same test with various values of MaxRequestsPerChild until you find a value that keeps Apache less than that.

share|improve this answer
How can I Test load the pages and see the size of the Apache processes using Windows Server? – Ahmad Alfy Mar 17 '13 at 8:54

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.