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 apache as backend server for nginx. Here is my config for prefork MPM which i use:

StartServers          1
MinSpareServers       1
MaxSpareServers       5
MaxClients           10
MaxRequestsPerChild   0

So as you can see, MinSpareServers is 1, which means that apache will kill all idle processes until there is only one. When i restart my server - its ok, in system only 2 apache processes (parent and child). After i load page, apache begin spawn childs, and when page is loaded - there is 5 childs of apache. Load on my server is very low, so i think that there is no reason for additional childs. How can i make apache work right ?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Apache is working exactly as expected. The Prefork MPM works on the one process per request principle.

Your browser uses around 8 concurrent connections to load a page in parallel. Therefore 8 processes will be started on your server until the request is complete and the browser disconnects. The parent server will see that there are unused servers that exceed your MaxSpareServers directive and kill 3 of them to bring it inline with your configuration.

You want child processes to exist before a connection has arrived from a client. It speeds everything up. It's not a bad thing.

share|improve this answer
add comment

If there are more than MaxSpareServers idle, then the parent process will kill off the excess processes. What you're doing doesn't make sense unless it's a embedded system with very little memory available.

share|improve this answer
add comment

You have MaxSpareServers set to 5, this is the number you need to tune as it is the maximum number of idle servers that are allowed. If there are more than MaxSpareServers idle, then the parent process will kill off the excess processes.

The lowest number you can set MaxSpareServers to is MinSpareServers +1.

http://httpd.apache.org/docs/2.2/mod/prefork.html

share|improve this answer
add comment

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.