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: [EMAIL PROTECTED]