Update 24th Oct

Dump of ps axl as requested by @David Schwartz : http://textuploader.com/?p=6&id=z8riS

During busy periods we hit Apache max connections (currently set to 256). I'd like to increase the max connections setting, but have been advised not to, due to our memory being over-committed during these periods. However, the actual RAM usage doesn't seem to be anywhere near the committed value.

How is the committed value calculated for Apache processes? And how can I reduce this?

I have already tried setting the PHP memory_limit to a lower value, but this has had no effect on the committed value in my munin graphs:

enter image description here

Server specs:

  • DELL PowerEdge 2950 MKIII
  • 8 GB RAM
  • Single Socket Quad Core Intel Xeon 5320 LV 1.86GHz
  • 2 x 146GB SFF 10K RPM Drive in RAID 1
  • Apache/2.2.15 (Unix)
  • PHP 5.3.3

The server is dedicated to Apache (MySQL is on another box).

  • The committed memory is just a warning -- it's the maximum amount of physical memory that might be needed if every process actually uses all the memory it has 'reserved'. Getting it down wouldn't help you as it would just mean you wouldn't be getting a valid warning. You're basically asking how to silence that annoying smoke detector. You should be trying to figure out what's burning -- if anything. – David Schwartz Oct 17 '12 at 14:10
  • Hi David. Yes, agreed. So how would I figure out what's burning? – Jon M Oct 17 '12 at 16:23
  • I would start by getting a ps axl output from a time when the committed memory level is high. See what processes have a high RSS, if any. – David Schwartz Oct 17 '12 at 16:24
  • @David Schwartz it's a fairly big amount of text: textuploader.com/?p=6&id=z8riS plenty of httpd processes (probably expected...) – Jon M Oct 20 '12 at 18:11

I'd try to separate serving of PHP scripts and static files.

You can serve static files very efficiently with worker MPM and even better with event MPM available for httpd 2.4+. But you can not use this MPM for serving PHP scripts, as PHP isn't thread-safe.

For PHP you can run a separate httpd instance (I'm running it on my server with Listen and configure main server as a reverse proxy:

ProxyPreserveHost On
DocumentRoot /var/www/html
RewriteEngine On
RewriteCond /var/www/html%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} \.php$
RewriteRule ^/(.*)$1 [P,L]

With mod_remoteip (again - available from httpd 2.4) it would be truly transparent for a PHP script.

Or use for example php-fpm.

This way request for static files, HTTP persistent connections etc. will use a fraction of RAM.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.