[ILUG] Apache gobbling CPU

Vincent Cunniffe vincent at cunniffe.net
Wed Aug 6 09:54:17 IST 2008


Niall O Broin wrote:
> I just encountered an odd situation on a webserver where the load had 
> become rather high, and top was showing me two apache processes each 
> consuming > 45% of CPU. Running strace on one of the processes I saw 
> that it was doing the below (and nothing else, or nothing else 
> strace-able) in a loop:

<snip>

> In all likelihood, this was caused by some piece of PHP gone mad but the 
> question is, what, and how to find out? Given such a situation, is there 
> any way of mapping a particular apache process to a request?

lsof -n|grep httpd|grep TCP|grep -v LISTEN

will tell you what IP address the apache process is connected to, 
assuming it's still connected and handling it. Then you can hunt that 
down in the request logs to find out the URL.

Vin



More information about the ILUG mailing list