What do users see when Apache reaches MaxClients

apache-2.2performanceperformance-tuning

Occasionally, in my Apache error log, I will find:

[error] server reached MaxClients setting, consider raising the MaxClients setting

I've purposely lowered MaxClients in the past (to 60) due to issues with running out of memory, but I'd like to know exactly what's happening on the user's end when this limit is reached on the server. Does the page they're accessing just take longer to load? Do they get some sort of error message?

Best Answer

At first, the client requests will get queued, until there is a process/thread that gets free on the apache server. So, the clients will see a delay in loading the page. See the MaxClients parameter documentation for more information.

When placed in the backlog queue, the client request can eventually time out on the client side. Then the user will see an error page in its browser telling that the server is taking too long to give an answer. The default time out value is 300 seconds in Firefox, for example. Or the user will cancel the request before the timeout ...

Then, if the server gets more requests and cannot get a free process/thread in time, the ListenBacklog queue can get filled (defaults to 511 queued requests) and any subsequent request will not get served at all. The browser will then tell the user it cannot connect to the website, like if the website was completely down.

This backlog queue is managed at the OS level, in the TCP implementation. Under linux, the listen man page will give you more information about the way it is managed. Here is another very insightful reading about the TCP backlog queue in linux and BSD systems.