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 have a question that maybe you can help me to answer. When I execute ps -aux from 00:00 to 00:03 I get about 30-40 apache processes but visits in such period of time are only 2 (Google Analytics). Why is this happening? All that Apache processes are eating my RAM...

Thanks in advance

share|improve this question
If you browse your site during this time, do the hits get recorded? – David Jul 11 '11 at 23:14
up vote 4 down vote accepted

Apache keeps a number of processes 'waiting for action'. That number is set in your httpd.conf file. Whenever a new request comes in, Apache will direct the request to one of the available processes. The number might drop a little when some processes are not in use, but there is typically a lower bound to how much it will drop.

Depending on whether you use 'Worker' or 'Prefork' as your process manager, the settings are slightly different:

From httpd.conf:

prefork MPM

  • StartServers: number of server processes to start
  • MinSpareServers: minimum number of server processes which are kept spare
  • MaxSpareServers: maximum number of server processes which are kept spare
  • ServerLimit: maximum value for MaxClients for the lifetime of the server
  • MaxClients: maximum number of server processes allowed to start
  • MaxRequestsPerChild: maximum number of requests a server process serves

worker MPM

  • StartServers: initial number of server processes to start
  • MaxClients: maximum number of simultaneous client connections
  • MinSpareThreads: minimum number of worker threads which are kept spare
  • MaxSpareThreads: maximum number of worker threads which are kept spare
  • ThreadsPerChild: constant number of worker threads in each server process
  • MaxRequestsPerChild: maximum number of requests a server process serves

Chances are that you have your 'StartServers' and 'MinSpareServers' set quite high. Take a look at this page on optimizing Apache for low memory.

share|improve this answer
After some investigation I found this as well, thanks for the link – LuisClemente Jul 12 '11 at 7:55

You should also note that visits in Google Analytics only represent that one client connected. They do not necessarily indicate their activities on the site (there are tools in Analytics for this). Your two clients could have been hammering Apache hard with multiple tabs open or something similar.

Furthermore, Apache processes don't go away immediately (unless you tell them to); those spare processes from 00:00 to 00:03 could have been from visitors prior to 00:00 that Analytics for 00:00 to 00:03 will not show. A window of 3 minutes is not terribly useful to you. You're better off looking at metrics for an entire day or week at a time to get a good feel for how to best configure your Apache child processes.

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.