1

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?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.