2

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 !

karancan
  • 141
  • 6

1 Answers1

1

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.

Bruno Mairlot
  • 411
  • 3
  • 5