3

I've scoured the web but I can't find out what MaxSpareServers are in Apache MPM prefork..

The MaxSpareServers directive sets the desired maximum number of idle child server processes. An idle process is one which is not handling a request. If there are more than MaxSpareServers idle, then the parent process will kill off the excess processes.

Great, but what causes a spareserver to be created? More importantly, when does a spare server go away? I understand that minspareservers are created gradually after the server is started..

How do maxspareservers relate to maxclients?

Basically I'm at a bit of a loss on how best to configure Apache.. there's a lot of documentation out there but it isn't that clear.

Thanks, John.

John Hunt
  • 428
  • 2
  • 10
  • 20
  • This is explained quite well in the Apache doc (http://httpd.apache.org/docs/2.2/mod/prefork.html), along with the hint that the default is usually a good starting point that shouldn't be changed if not really necessary. – Sven Oct 02 '12 at 15:23

2 Answers2

4

If somehow there are less spare server processes than MinSpareServers, Apache will attempt to create spare server processes until they are at least MinSpareServers.

If you have load on your server, Apache will create more server processes up to MaxClients. As long as they are in use they will not be killed, but if the load drops, Apache will start killing the processes until there are at most MaxSpareServer processes left.

Christopher Perrin
  • 4,741
  • 17
  • 32
0

You can assume maxClients as max servers apache will spawn.

There is a different, maxSpareServers dictate how much maximum number of apache child process will be kept.

MaxClients directive will dictate how much apache will spawn child process to handle spike in request.

So when there is decreasing in number of request, apache will start kill the child server until it reach maxSpareServers not minSpareServers.

Since there is overhead on creating new child process, you should set maxSpareServers quite high if you're expecting your server to handle a lot of requests. But do not set it too high, because if you have fewer requests, there are a lot of apache processes on the server doing nothing except occupying the memory.

Basically set it between minSpareServers and maxSpareServers.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
slier
  • 101
  • 2