Apache thrashing my swap...

2001-02-28 Thread Jason Terry

I am running
Apache/1.3.14 (Unix) mod_perl/1.24_01 PHP/4.0.3pl1 mod_ssl/2.7.1 OpenSSL/0.9.6

And run several database and MEMORY hogging mod_perl scripts...  My problem is that 
recently I have had some users that are getting
impatient and hitting the reload/refresh button OFTEN.  In some instances this causes 
one single person to have over 40 httpd
children service JUST them.  This causes my server to start thrashing swap...

Does anybody on this list know of a way to limit the number of connections apache will 
allow per IP address (before any reverse
lookups would be nice)?  I would like to set this to like 10-15 or so if it is 
possible?  I know that this could cause some people
with proxy servers to be limited, but I figure 10-15 httpd children should be able to 
handle most proxy systems just fine...

I know this isn't really a mod_perl problem... but I also know that this list is 
probably the most likely to have other people who
have exactly this issue on their machines

Thanks in advance
-Jason




Re: Apache thrashing my swap...

2001-02-28 Thread Dave Hodgkinson

"Jason Terry" [EMAIL PROTECTED] writes:

 I know this isn't really a mod_perl problem... but I also know that this list is 
probably the most likely to have other people who
 have exactly this issue on their machines

I wonder if putting a thin apache on the front of a very limited fat
apache would at least get you somewhere near where you want to be. If
someone hits stop before something gets passed to the fat apache, will
it get tossed completely?

Having a maxclients limit on the fat apache will keep memory and CPU
usage sane.

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -



Re: Apache thrashing my swap...

2001-02-28 Thread Perrin Harkins

On Wed, 28 Feb 2001, Jason Terry wrote:
 My problem is that recently I have had some users that are getting
 impatient and hitting the reload/refresh button OFTEN.  In some
 instances this causes one single person to have over 40 httpd children
 service JUST them.  This causes my server to start thrashing swap...

First, put something in place so that your server will never go into
swap.  I prefer a combination of MaxClients and Apache::SizeLimit.  Also,
if you haven't moved your images to another server and/or put a proxy
server in place, do that.

 Does anybody on this list know of a way to limit the number of
 connections apache will allow per IP address (before any reverse
 lookups would be nice)?

If you set a unique cookie, you could limit based on that and fall back to
IP address if you don't find a cookie.  That will help with the proxy
issue.  You could adapt one of the existing modules for this purpose, or
maybe grab Randal's Stonehenge::Throttle code from the list archives.

Be careful.  Blocking users is always a dangerous thing to do and may be
more trouble than it's worth.  You could check the list archives for
discussions of how to handle long-running tasks for ideas on interface
changes that might solve your problem.

- Perrin




Re: Apache thrashing my swap...

2001-02-28 Thread Stas Bekman

 On Wed, 28 Feb 2001, Jason Terry wrote:
  My problem is that recently I have had some users that are getting
  impatient and hitting the reload/refresh button OFTEN.  In some
  instances this causes one single person to have over 40 httpd children
  service JUST them.  This causes my server to start thrashing swap...

See
http://perl.apache.org/guide/debug.html#Handling_the_User_pressed_Stop_

  Does anybody on this list know of a way to limit the number of
  connections apache will allow per IP address (before any reverse
  lookups would be nice)?

You don't want to do that. Think of AOL users who all come through the
same proxy (well a few).

This is not a situation where throttling helps, as with stopping rude
robots. Your purpose it to stop the script on abort, not to limit users.

Also you may want to revise your code to minimize the possibility of users
try to restart the request all the time. See the performance chapter in
the guide.

_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/