You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Mark Maunder <ma...@swiftcamel.com> on 2001/10/18 00:36:49 UTC

multiple rapid refreshes - how to handle them.

Is there a standard way of dealing with users who are on high bandwidth
connections who hit refresh (hold down F5 in IE for example) many times
on a page that generates alot of database activity?

On a 10 meg connection, holding down F5 in IE for a few seconds
generates around 300 requests and grinds our server to a halt. The app
is written as a single mod_perl handler that maintains state with
Apache::Session and cookies. content is generated from a backend mysql
database.

tnx!




Re: multiple rapid refreshes - how to handle them.

Posted by Les Mikesell <le...@home.com>.
This doesn't solve the specific problem, but it is a good idea
to tune 'MaxClients' down in httpd.conf to a number that your
server can sustain.   The browsers may see a few errors during
the overload but the server will recover a lot faster when it stops.

  Les Mikesell
    lesmikesell@home.com


----- Original Message ----- 
From: "Mark Maunder" <ma...@swiftcamel.com>
To: <mo...@apache.org>
Sent: Wednesday, October 17, 2001 5:36 PM
Subject: multiple rapid refreshes - how to handle them.


> Is there a standard way of dealing with users who are on high bandwidth
> connections who hit refresh (hold down F5 in IE for example) many times
> on a page that generates alot of database activity?
> 
> On a 10 meg connection, holding down F5 in IE for a few seconds
> generates around 300 requests and grinds our server to a halt. The app
> is written as a single mod_perl handler that maintains state with
> Apache::Session and cookies. content is generated from a backend mysql
> database.
> 
> tnx!
> 
> 
> 


Re: multiple rapid refreshes - how to handle them.

Posted by Perrin Harkins <pe...@elem.com>.
> Is there a standard way of dealing with users who are on high
bandwidth
> connections who hit refresh (hold down F5 in IE for example) many
times
> on a page that generates alot of database activity?

Try this:
http://www.stonehenge.com/merlyn/LinuxMag/col17.html

- Perrin




Re: multiple rapid refreshes - how to handle them.

Posted by Wim Kerkhoff <wi...@merilus.com>.
Mark Maunder wrote:
> 
> Is there a standard way of dealing with users who are on high bandwidth
> connections who hit refresh (hold down F5 in IE for example) many times
> on a page that generates alot of database activity?
> 
> On a 10 meg connection, holding down F5 in IE for a few seconds
> generates around 300 requests and grinds our server to a halt. The app
> is written as a single mod_perl handler that maintains state with
> Apache::Session and cookies. content is generated from a backend mysql
> database.

That mod_perl book has an example of how to create a handler that will
block greedy clients, such as somebody holding down the refresh button:

http://www.modperl.com/book/chapters/ch6.html#Blocking_Greedy_Clients

In brief, the concept is that you have a hash that is shared between all
processes via IPC::Shareable. On the first request from that client, you
set the counter to 0. On succeeding requests, you do a check to see if
the counter is greater than the forgivable amount for the elapsed time
period. If they've put too many requests through in X seconds, just
return FORBIDDEN or some other appropriate status. This simple handler
would run before you existing mod_perl handler.

-- 

Regards,

Wim Kerkhoff, Software Engineer
Merilus, Inc.  -|- http://www.merilus.com
Email: wim@merilus.com