8

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?

  • 1
    Probably wouldn't be hard to build a test for this. In a test server, try dropping MaxClients to 1 and see what happens when you refresh things in multiple windows or tabs. – ghoti Apr 16 '15 at 15:19
  • Definitely - I was hoping someone would know before I do that. I can't find any info in Apache's documentation. – runningonplants Apr 16 '15 at 15:50
13

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.

  • Exactly what I needed to know. Thank you! Do you happen to know if there's a way to see how many processes are in the ListenBacklog queue? – runningonplants Apr 16 '15 at 18:04
  • 1
    This backlog queue is managed by the OS, as part of the tcp stack. Have a look at the listen man page. I'm not sure there's a direct way of knowing what this queue contains. Also, see this SO question. I've added more info to my answer. – Tonin Apr 16 '15 at 18:38

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.