I'm aware of the Apache directives MaxClients
and ListenBacklog
. I'm trying to set a limit of, let's say 100 concurrent connections after which the new connections will be served a static page. Can this be done? Should MaxClients
and ListenBacklog
be higher or lower than that limit? How can I test it?
If Apache can't accept the incoming connection because it's already handling MaxClients, then it can't serve a static page. So, I don't have any hard evidence, but I don't see how you could achieve this with just Apache alone. You might be able to put something in front of Apache which returns a static page if Apache returns a connection failure, but it seems like a lot of complex config to me. Hopefully someone will be along to prove me wrong.
Here's how I did it: Let's say that I want to allow X concurrent requests, after which the following Y concurrent requests will stay in a queue, waiting for the frist X to finish, and everything exceeding X+Y will be served a static page:
In
httpd.conf
the following directives must be set:Logged as root in MySQL, set
max_connections
:Edit the
.htaccess
file from your server's public root folder:Make sure that your error_503.html is served in one request. All stylesheets and scripts must be in this file. If you want to include images, you'll have to use the data uri scheme. Also, you'll have to slice your images up because in IE data URIs have to be smaller than 32KiB.