Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

Thanks,

Tam

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

EDIT:

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
</IfModule>
share|improve this answer
    
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. –  Lena Schimmel Jul 2 '10 at 16:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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