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 VPS with root access at my hosting (Dreamhost). When I type top in console I see a huge number of running Apaches. See fragment:

14464 dhapache  20   0  119m 9900 1724 S    0  2.3   0:00.05 apache2-ps13837
14939 dhapache  20   0  119m 9868 1704 S    0  2.3   0:00.02 apache2-ps13837
14940 dhapache  20   0  119m 9680 1708 S    0  2.3   0:00.00 apache2-ps13837
14958 dhapache  20   0  119m 9768 1716 S    0  2.3   0:00.02 apache2-ps13837
14967 dhapache  20   0  119m 9816 1708 S    0  2.3   0:00.01 apache2-ps13837
15026 dhapache  20   0  118m 9476 1580 S    0  2.2   0:00.00 apache2-ps13837
15031 dhapache  20   0     0    0    0 H    0  0.0   0:00.00 apache2-ps13837
15032 dhapache  20   0  119m 9712 1700 S    0  2.3   0:00.00 apache2-ps13837
15035 dhapache  20   0  118m 9472 1576 S    0  2.2   0:00.00 apache2-ps13837
15036 dhapache  20   0  118m 9468 1572 S    0  2.2   0:00.00 apache2-ps13837
15037 dhapache  20   0  119m 9444 1528 S    0  2.2   0:00.00 apache2-ps13837
15038 dhapache  20   0  118m 9472 1576 S    0  2.2   0:00.00 apache2-ps13837
15040 dhapache  20   0  118m 9472 1576 S    0  2.2   0:00.00 apache2-ps13837
15041 dhapache  20   0  118m 9472 1576 S    0  2.2   0:00.00 apache2-ps13837
15042 dhapache  20   0  118m 9472 1576 S    0  2.2   0:00.00 apache2-ps13837
15043 dhapache  20   0  118m 9520 1616 S    0  2.2   0:00.00 apache2-ps13837
15046 dhapache  20   0  118m 9484 1580 S    0  2.2   0:00.00 apache2-ps13837
15047 dhapache  20   0  119m 9452 1528 S    0  2.2   0:00.00 apache2-ps13837
22909 root      20   0 11520 2820  604 S    0  0.7   0:03.41 syslog-ng
22921 root      20   0 27024  960  852 S    0  0.2   0:01.26 sshd
22935 root      20   0  3900  332  328 S    0  0.1   0:00.00 courierlogger

even when there are very few visitors on my site. How can I limit number of Apaches to reduce memory usage? Thanks!

share|improve this question
add comment

2 Answers

This depends on the version of Apache you are using and the MPM module you're using by default. Please supply us with that information for a more accurate diagnosis

I'm going to take a guess you're using the worker module as this is the default on most distributions I've seen. To check, however, you need to run httpd -l or in your case, as your apache binary seems to be called apache2-ps13837 you need to call apache2-ps13837 -l

Because Apache, with most modules is not a single threaded process, and generally relies on multiple processes to handle requests, it starts up processes before they're needed. This increase the ability of Apache to handle incoming requests once they are needed.

In this case, you want to look at the MPM variables for your relevant MPM module. However, if you're seeing so many processes in your process listing, you probably want to have a look at StartServers & ServerLimit or MinSpareServers (if you're using the prefork MPM.)

Again we can give more specific information if you can tell us what MPM you're using.

share|improve this answer
add comment

Check out MPM.

in httpd.conf:

ServerLimit 5
share|improve this answer
add comment

Your Answer

 
discard

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