In Apache / cPanel, I can set the number MinSpareServers and MaxSpareServers. But the user of idle process is nobody.

I am running SuPHP , and PHP is running under CGI. So, If I increase Min / Max spareServer number for my busy site, will the it effect with CGI/SuPHP ? or it only help increase speed for DSO under nobody?

( I am using Nginx as Proxy to handle static files )

If I can search this question on Google, I don't need to ask here.


1 Answer 1


From what I know, the number of "spare" servers is, as the name suggests, the number of worker processes the apache server is preparing in advance to serve future requests.. (I'm assuming an "MPM-prefork" configuration here)

It is quite difficult to say in general if it will give a boost or make the server hog, since it depends on a number of factors: the kind of activity the server does, on the usage pattern, the number and duration of connections, memory size required to process each request, keepalive settings, etc...

As a general rule consider that having too much spare servers is a waste, since you'll have your apache using memory to keep ready a number of processes, just in case they are needed, even if they are not needed, maybe reduncing the memory available to the running processes.

On the other hand, having too few spare servers forces clients to wait for the apache process to create a new one to handle the request, have it up and running and then pass the connection to it so it can go on working it..

Bottom line: youl'll probably have to tweak more parameters than the two you mentioned, and you'll have to balance them by figuring out which settings are best for your situation.

Just to mention it, since you'll might find it useful, check out the "server status" page (you can see it also using the apachectl from command line, look on the man pages): it will show you a lot of details about the state of the running processes, so you can judge if you have too many or too few slots serving requests.

Also check if your usage pattern would benefit from a keep-alive, so that short and close-in-time requests from the same client get served by the same worker process, without having to settle a new connection on each request. Don't push too much on keepalive duration, anyway, otherwise the worker process will have to wait a lot before accepting a new client, and you'll eventually run out of free slots to serve new requests..

As you can see, there's a lot of space for tweaking, but the reason is simple: each situation is different, so you have to know which knobs to turn and then try a bit..


[edit] Here is the link where Min/MaxSpareServers Directives are described in the official Apache2.2 documentation.

MaxSpareServers Directive

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. Tuning of this parameter should only be necessary on very busy sites. Setting this parameter to a large number is almost always a bad idea. If you are trying to set the value equal to or lower than MinSpareServers, Apache will automatically adjust it to MinSpareServers + 1.

MinSpareServers Directive

The MinSpareServers directive sets the desired minimum number of idle child server processes. An idle process is one which is not handling a request. If there are fewer than MinSpareServers idle, then the parent process creates new children at a maximum rate of 1 per second. Tuning of this parameter should only be necessary on very busy sites. Setting this parameter to a large number is almost always a bad idea.

In the same page there is a good description of what the mechanics are:

A single control process is responsible for launching child processes which listen for connections and serve them when they arrive. Apache always tries to maintain several spare or idle server processes, which stand ready to serve incoming requests. In this way, clients do not need to wait for a new child processes to be forked before their requests can be served.

The StartServers, MinSpareServers, MaxSpareServers, and MaxClients regulate how the parent process creates children to serve requests. In general, Apache is very self-regulating, so most sites do not need to adjust these directives from their default values. Sites which need to serve more than 256 simultaneous requests may need to increase MaxClients, while sites with limited memory may need to decrease MaxClients to keep the server from thrashing (swapping memory to disk and back). More information about tuning process creation is provided in the performance hints documentation.

  • 1
    of course, most of the reasoning is related to what is being served dynamically by apache, which is often the biggest part.. Static files serving is a simpler task, as compared to that, so I didn't take it in account
    – Luke
    Jun 5, 2013 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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