2

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).

4
  • 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. Oct 17, 2012 at 14:10
  • Hi David. Yes, agreed. So how would I figure out what's burning?
    – Jon M
    Oct 17, 2012 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. Oct 17, 2012 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, 2012 at 18:11

1 Answer 1

0

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 127.0.0.2:488) 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 ^/(.*) http://127.0.0.2:488/$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.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .