httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bennett Haselton <>
Subject [users@httpd] how to see/log the amount of CPU time a request takes
Date Tue, 06 Jul 2010 08:56:21 GMT
I am trying to identify which requests coming in to my web server are 
taking up the most CPU time.
says that one of the things you can log in a log file is "The time 
taken to serve the request, in seconds", however, this counts wall 
clock time, not CPU time.  (I confirmed this using a test script that 
did nothing but sleep for 20 seconds and exit -- the log file 
recorded it as taking 20 seconds. to serve.)

I have tried installing mod_status (with ExtendedStatus On) and 
looking at server_status, but it doesn't appear to display the amount 
of CPU time that a request has used.
says that one of the "details given" is "The current percentage CPU 
used by each worker and in total by Apache".  However, it seems like 
this is incorrect -- the "CPU" column doesn't give the percentage of 
CPU used by the worker, it gives the total CPU time used.  (And it's 
not clear if that refers to CPU time used by that *child*, or by that 
"slot", or what.  I know that column isn't displaying total CPU time 
used by the current request, because it often displays a number of 
seconds which is greater than the number of seconds that have passed 
since a given request was started.)

The only way I can find to identify cpu-intensive requests, is to 
write a script that grabs the server-status page, then does 'ps auwx' 
to cross-reference the processes on the server-status page with their 
pids in 'ps auwx' and get the percentage of CPU usage.  (I need both 
because server-status doesn't show CPU usage, and ps auwx doesn't 
show the first line of the http request, it just shows the process as 
/usr/sbin/httpd.)  Is there a more straightforward way to do it?


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message