-2

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 ?

kirugan
  • 105
  • 3

3 Answers3

1

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.

James Park-Watt
  • 358
  • 1
  • 8
0

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

user9517
  • 114,104
  • 20
  • 206
  • 289
0

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.

FINESEC
  • 1,371
  • 7
  • 8