Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to limit the number of client allowed on my apache httpd server (mpm_prefork).

When the number of client is reached, I want to display a custom error message such as "Error 503 : Too many connections".

The customisation is possible using :

ErrorDocument 503 "Sorry, too many connexions."

The apache httpd configuration "MaxClients" queue all the clients (until the ListenBackLog is reached) instead of returning en error message.

=> How is possible to raise an error 503 when the number of client is reached ?

share|improve this question

migrated from Nov 9 '12 at 15:43

This question came from our site for professional and enthusiast programmers.

even though this is a valid question, this belongs on serverfault – Daniel A. White Nov 9 '12 at 13:49
If MaxClients is reached, the response is 503. There is no "how" or "if". – adaptr Nov 9 '12 at 16:02
@adaptr Have you tested this? This is not the behavior I'm seeing on apache 2.2. I've gotten 10 clients to connect with MaxClients=5 and ListenBackLog=100. I have a cgi on the other end that records the start time and waits 1 second. Five of the clients showed a start time one second later than the other 5 clients, but none were rejected. – Kelvin Nov 15 '12 at 19:57
This is a bad idea. Clients do not need to know this, and it exposes you. – gparent Nov 16 '12 at 23:52

I would NOT put up a web page for going over some number of connections. Why tell anybody about a potential limit in your site? If you have a monitoring system, monitor your number of connections and have your monitoring system alarm when you go over that number. The monitoring system could email you or a coworker or even a client, but, just my 2 cents...I would not notify the world that a maximum number of connections has been exceeded.

share|improve this answer
Because it's better to have a website that works well for 75% of your visitors (with the other 25% asked to come back later), than to have a website that fails to work for anyone. Obviously you should have monitoring and (auto) scaling where possible, but sometimes things just do go wrong. – Jay Nov 17 '12 at 1:50
I think it's better to inform the users instead of rejecting or waiting until the timeout is reached (default behaviour of apache httpd). Same as the "maintenance mode", the user prefers being informed "Site under maintenance" instead of getting the browser message "the site is not reachable.." – Cyrus31 Nov 22 '12 at 12:28

Your Answer


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.