6

I had an issue with my project yesterday. It couldn't even be opened from browser. The issue resolved after restarting apache. After that I checked the apache logs and found follwing lines.

[error] server is within MinSpareThreads of MaxClients, consider raising the MaxClients setting

Can someone explain what is the meaning of this message ? Could it cause such issue.

Should I really need to increase MaxClients or would it be better to understand what cause server to reach MaxClients..

4

Apache has a limit of how many concurrent connections it can handle. This limit is set with MaxClients. When the server reaches that number of simultaneous connections, any subsequent connection can't be handled until one of the existing connections is closed.

You also have a setting called MinSpareThreads, which tells the server how many threads should be started, waiting for a new connection. So let's say that your server is set like this:

 MaxClients 100
 MinSpareThreads 5

Then, the server will try to always have 5 threads ready and waiting for a connection. But once you have 95 users connecting at the same time, you only have room for 5 more, so once the next client connects, the server will no longer be able to create any more spare threads - so the log message is telling you that it's getting close to the MaxClients setting.

It's always a good idea to understand why the server is reaching MaxClients. Its value should be high enough to serve a normal load + a reasonable spike in traffic, but low enough that even if someone tries to DOS your web server, apache will not use up all your memory and CPU by serving too many customers. To find out the optimal value you need to do some load testing.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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