Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 17190 invoked from network); 6 Jul 2010 08:58:03 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Jul 2010 08:58:03 -0000 Received: (qmail 12761 invoked by uid 500); 6 Jul 2010 08:58:00 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 11978 invoked by uid 500); 6 Jul 2010 08:57:56 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 11970 invoked by uid 99); 6 Jul 2010 08:57:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jul 2010 08:57:55 +0000 X-ASF-Spam-Status: No, hits=0.8 required=10.0 tests=MISSING_MID,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: 69.17.117.49 is neither permitted nor denied by domain of bennett@peacefire.org) Received: from [69.17.117.49] (HELO mail5.sea5.speakeasy.net) (69.17.117.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jul 2010 08:57:45 +0000 Received: (qmail 9687 invoked from network); 6 Jul 2010 08:56:23 -0000 Received: from pool-71-112-32-149.sttlwa.dsl-w.verizon.net (HELO your-4dacd0ea75.peacefire.org) (bhas@[71.112.32.149]) (envelope-sender ) by mail5.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 6 Jul 2010 08:56:22 -0000 X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9 Date: Tue, 06 Jul 2010 01:56:21 -0700 To: users@httpd.apache.org From: Bennett Haselton Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Checked: Checked by ClamAV on apache.org Message-Id: <20100706085752.D3507816047@nike.apache.org> Subject: [users@httpd] how to see/log the amount of CPU time a request takes I am trying to identify which requests coming in to my web server are taking up the most CPU time. http://httpd.apache.org/docs/2.0/mod/mod_log_config.html 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. http://httpd.apache.org/docs/2.1/mod/mod_status.html 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? -Bennett --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org