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.

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.

share|improve this question
add comment

1 Answer

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..

HTH

[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.

share|improve this answer
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 '13 at 22:13
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.