Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 running a web application on a CentOs 6 machine with 4 gigs of memory and 3 processor cores (Intel Xeon 2.9 Ghz).

Every morning between 8.30 and 9.30 AM (which coincides with the time period when most people come in to work and start using this application), Apache stops taking any new requests because the MaxClients setting crosses 256 (which was the default).

At any given point, I have 15 users using the application and the times of activity on this application are between 8.30 AM and till about 4.30 PM.

To try and understand what may be causing this MaxClients setting to be surpassed, I started monitoring how many requests my machine is making to the server during and after the page has loaded. About 40 minutes of monitoring resulted in this:

enter image description here

As can be seen, my web application use CometChat to allow users to interact with each other and AFTER page load, all activity is coming from CometChat making AJAX requests to get updates.

Just now, I ran this command in shell to get the number of apache threads running:

pidof httpd | wc -w

The result was: 245. This number consistently rises after I restart Apache. The average (resident) memory taken up by these processes is about 18M.

245 processes with 18M per process results in more than 4 gigs of RAM usage.

Now, for my questions:

  • Is my client (or CometChat on behalf of my client) making too many requests? Is the amount of data being transferred unusually high?
  • What do I do to prevent the MaxClients setting to be surpassed?

This is a low traffic time for us. In the coming months, traffic will only increase. Any help is appreciated !

share|improve this question
Which MPM are you using? – Shane Madden Jul 19 '13 at 18:10
It is the pre-fork – karancan Jul 19 '13 at 18:13
Will your application function with worker? – Shane Madden Jul 19 '13 at 18:24
That is a last resort.... – karancan Jul 19 '13 at 18:30
I'd run Fiddler on a client to see what it thinks is going on and why there are multiple sessions per client... Also try running their; it "cleans up db tables" but maybe it cleans up old sessions too. – Ernest Mueller Jul 19 '13 at 21:17

Very often httpd process are still present but are not serving client requests.

Have you tried to increase the amount of MaxClients and ServerLimit while decrease MaxRequestsPerChild ?

If you can't increase MaxClients because of memory, then try to limit the StartServers and MinSpareServer MaxSpareServer to their minimum (somewhere around for both 5).

Decreasing the value of MaxRequestsPerChild will recycles the process much faster but it won't allow to accept more clients at the same time but it will help avoid congestion in the event a client keeps connected (either at the TCP level or with a Keep-Alive).

You may also try to force Keep-Alive to off in order to ensure that each request gets correctly closed (and then recycled)

Finally, if you can't adjust and you effectively have simultaneously 256 clients, then you should look how to increase memory.

share|improve this answer

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.