Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 have a memory problem with my servers (Debian 6.0) where is installed Apache httpd 2.2, mod_php and APC.

Actually it seems that httpd allocate all available memory (4GB) when is waiting too much for an answer from Mongodb (30 seconds timeout). Ok, I know, 30 seconds timeout is too high. This long wait lead the frontend server to start to swap memory, the load average reach very high values (around 200) until the hw is completely stuck.

I suppose the problem is in the current httpd configuration, because MaxClients is set to 200 and PHP memory limit to 128MB. In worst case we need only for each PHP engine at least 25GB of RAM, but we have 4GB.

  • 128 megabytes * 200 = 25 gigabytes

My humble opinion is that: having 4GB, if we shrinking php memory_limit to 96MB, we should support about 48 fork (i.e. MaxClients 48). Even because an Apache httpd forks a new child, most of the memory is shared with the parent process.

  • Total Memory 4GB = Apache child 96MB * 48 MaxClients

But how to know exactly how much memory is shared by all httpd children and how much is allocated by each apache httpd process?

And talking about PHP and APC, even in this case, how to know how much memory is shared and how much is allocated by each engine?

share|improve this question
Are you sure it's just waiting for an answer from MongoDB and not reading a full result in memory ? – sivann May 14 at 18:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.