I have a Debian Linux VPS server for my production website (512MB).

I'm using Phusion Passenger with Apache to service my Rails 2.3.4 application with Ruby 1.9. I'm limiting the pool of Phusion passenger instances to 3

Although the traffic is relatively low, the server crashes at times and I notice (when using 'top' command) that there are many instances of apache (/usr/sbin/apache2 -k start) maybe like 20 of them taking up all the memory I have and the website become un-responsive.

I'm not sure what to do about this, where to start digging for potential issues or how to spot or limit the number of apache instances.




That's going to be your MPM setup. Your on a *nix box so it is probably Prefork you can verify this by running httpd -l (or oddly on ubuntu it's apache2 -l) to see the compiled in modules.

What you are going to want to go to your httpd.conf (or apache2.conf depending on your setup) and edit the appropriate config for your MPM workers to suit your environment.


You are running the prefork mpm as shown but the prefork.c being listed as compiled in. You'll want to go into /etc/apache2/apache2.conf (I only have Ubuntu boxes to check but since it's a Debian derivative it should be the same).

You'll find a section that looks like the one shown below. Edit those values.

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
  • Excuse my lack of experience with Apache..I tried apache2 -l (as I'm using Debian..httpd -l didn't work) and I got the following: core.c mod_log_config.c mod_logio.c prefork.c http_core.c mod_so.c How do I edit my MPM worker from here?
    – Tam
    Dec 22 '09 at 5:58
  • 1
    Many thanks to bosth the question poster and the author of this answer. I had the same problem on a virtual server with 512MB RAM and thought I'd have to change to another (bigger) vserver beacuse it kept crashing once a day because of too many apaches. Jul 2 '10 at 16:53

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.