Re: dealing with CPU hogs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 6 Jul 2007 16:30:32 -0400
"Tony Rice \(trice\)" <trice@xxxxxxxxx> wrote:

> Any suggestions on configuration changes I can make to lessen the
> impact of CGI scripts which become CPU hogs? 
> I'm running an apache server with about 150 virtual servers.
> Ocassionally an errant script will go nuts and consume 100% of the
> CPU.  It's really bad when a spider finds one of these poorly written
> scripts and calls it a few thousand times.

Two suggestions:

(1) Use ulimit to limit what a CGI script can have.
(2) Use mod_load_average (google for where it is) to refuse to
run the bad scripts, or refuse to run any script, when the server
is busy (as measured by system load average).

If you can identify bad spiders reliably, e.g. by IP address or
User-Agent, you can block specifically that.  There's a mod_rewrite
recipe for that, or there's mod_robots, which I hacked up quickly
to deal with a particular robot that was causing a similar problem.

>	 Any other suggestions?  Can consistent
> connections be throttled on a per client IP address basis?   Can
> server processes be controlled on a per virtual server basis?

Take a look at modules.apache.org for bandwidth-limiting modules.
But they really solve a different problem.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux