httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jsl...@gmail.com>
Subject Re: [users@httpd] Apache overloaded message
Date Thu, 23 Dec 2004 18:22:06 GMT
On Thu, 23 Dec 2004 11:40:56 +0100 (CET), apache@valli.org
<apache@valli.org> wrote:
> Hi all,
> How can I configure apache (1.3.xx) webserver, that it sends a small
> message like 'I'm currently overloaded. Please try it later again'?
> 
> I think apache should send this message if MaxClients (configured in
> httpd.conf) is reached.
> 
> I've done some tests but unforunatelly without success.
> Here is one:
> According to http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
> I tried the following in my apache-config:
> MaxClients 32
> ErrorDocument 503 "OVERLOADED: try later again
> 
> Now I produced a lot of requests
> # ab -n 200 -c 200 http://myurl/
> 
> During ab is running I connected with a webbrowser to http://myurl/.
> => The webbrowser now tried to load the site
> => Finally (after a very long waiting) i receive the site
> 
> That's not what I want. I excepted to receive in a short time
> the answer "OVERLOADED: try later again"
> 
> Any Ideas?

This is actually harder than it looks.  In order to deliver the 503
error document, there must be an httpd worker available.  But if you
have hit your MaxClients, no workers will be available, hence no
possibility to deliver the error.  (An error document is just like any
other http response.)

What you probably want is a system to designate some level of usage
*below* maxclients that will trigger all future requests to get a 503
error.  Apache doesn't support this directly, and it is not a trivial
thing to do with a CGI script because it involves consulting the
apache scoreboard.  I wouldn't be surprised if there was a module that
did this, but I don't know for sure.

Note also that the effect probably won't be exactly what you want,
because there is a high probability someone will successfully grab an
html document, then get 503 errors on embedded images, css, etc,
resulting in an ugly mess.  What you *really* want is probably some
kind of session management technique (cookies, etc) that will allow
you to count sessions and limit them to a pre-specified number.  How
you do that depends entirely on what you are using to generate your
web content.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message