Apache’s MPM-prefork Leaking Memory

Apache’s MPM-prefork Leaking Memory

I’ve noticed in the last few weeks that my VPS host this site runs on has been running out of guaranteed physical memory.  This is the memory usage graph:

My VPS memory usage for 4/7/09 4/10/09
My VPS memory usage for 4/7/09 4/10/09

When this happens, many (but not all) of the sites served on this server stop responding to HTTP requests.  A simple ‘ps’ command shows anywhere around 8-15 “apache2” processes each having approximately 40-50MB footprint in the system memory.  Since I had not experienced this problem in the last 2 years prior to upgrading the apache2-mpm-prefork package on 3/17/09, I thought the mpm-prefork module might have something to do with this.

After reading Apache’s documentation on mpm-prefork and performance hints, I thought the mpm-worker module might work a bit better for my site.  My curiosity, however, told me to stick with mpm-prefork for the time being and change MaxClients parameter from 150 down to 10.

I have been monitoring the server to see how this affects memory usage and overall performance.  I have a feeling there is a bug in apache2-mpm-prefork 2.2.8-1ubuntu 0.5.  Feedbacks are welcome.

Here’s a link to an interesting article about tuning apache’s configuration file:
Apache Performance Tuning.

2 thoughts on “Apache’s MPM-prefork Leaking Memory

  1. Sweet. I’ve been banging my head off my desk for about an hour. I am tnryig to compile PHP 5.3Alpha to test some of the intl() features and that requires a custom compilation of PHP. I was hoping to use the Apache that is installed with apt-get but I assume doing so doesn’t bring along the apxs2 tool?To be honest I’m not even sure if I need that tool to build PHP or if I might assume Apache (by default) allows dynamic modules, which I assume it does I’ve added modules on the fly before (ie: mod_rewrite) but at least I know now when I attempt to compile and it fails I can try this and see if that corrects the issue. Thank you kindly I love short and sweet blog entires like this Cheers,Alex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.