marco wrote:
Il 24/05/2011 17.35, Adam Prime ha scritto:
On 11-05-24 11:30 AM, marco wrote:
Hi all,
I want to get the response time that Apache spends to serve a request
(from post-read-request phase to the response phase).
Any idea?

Thanks

I'm pretty sure there are messages buried in the archives (from torsten) showing how to do this with $r->push_handlers and Time::HiRes (or something along those lines). It's not really that complicated though, you basically just have a PostReadRequestHandler that uses push_handlers to push a handler into every phase that just logs the current time, or whatever it is you want to log.

Adam


Hi Adam,
I'm in this list only since 2 weeks. Can you tell me where can I find this mails?
Thanks a lot.


To answer you last question :

Go to : http://perl.apache.org/
On the left side, there is an item : Mailing lists
This leads you to the :         mod_perl Users mailing list
This leads you to the : Searchable archives
where you have a choice of searchable archives.
and have a look for example at "marc.theaimsgroup.com"

Apart from that, and for the main issue :

Is it not easier to just read the Apache access log a posteriori, and filter the lines which you need ?
With the appropriate LogFormat, you can have the microseconds needed for each 
request.

See : http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats
(parameter %D)

e.g.
LogFormat "%a - %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" 
combined_ip
CustomLog /var/log/apache2/somehost/access.log combined_ip

Sample log line with the above format (server name changed for privacy) :

192.168.193.11 - U367532 [24/May/2011:17:49:05 +0200] "POST /starweb/OPAC/servlet.starweb HTTP/1.0" 200 28029 "http://somehost.mycompany.com/starweb/OPAC/servlet.starweb?path=OPAC/STARLibs_OPAC_xxx.web"; "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)" 147626


(the last number is the number of microseconds needed to process that request)

Reply via email to