Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

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.