Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm currently logging "The time taken to serve the request, in microseconds" using the %D directive (as specified on https://httpd.apache.org/docs/2.4/mod/mod_log_config.html). However, this seems to log only the time used by Apache to create the response. Is there some way I can log the total time that the client is connected to the server? For example, Apache may create the page in 200 ms, but the client takes 2 seconds to download the page, because of a slow network. I'm interested in the 2 seconds here, since I want to measure the clients performance relative to this specific server.

share|improve this question
    
Can you clarify how you determined that it's just measuring the time taken to build the response? I've never messed with that specific LogFormat option before, but I'm testing it with a file that takes a few seconds to download, and the %D output to the log is a few million microseconds, which lines up nicely with the download time. –  Shane Madden Jul 19 '12 at 3:54
    
I'm downloading the same file from different client locations. The server logs around 200 for %D (microseconds) and 0 for %T (seconds). The clients take around 10 times that to download the files though. Client-side I'm testing both with curl (time curl domain.tld) and ab (ab -n 10 domain.tld). Both ways report a download time of around 2 seconds. –  Martin Jul 19 '12 at 6:19
    
Interesting. What amount of data are we talking about? I wonder if Apache stops counting once it gets all the data sent down to the TCP stack.. –  Shane Madden Jul 19 '12 at 16:34
    
Around 1MB. If what you say is the case, is there any way to measure the whole time used by the client? One question is whether it can be done (by any web server software). I guess it can since it can measure the time between the client connecting and disconnecting. The other question is whether Apache can do it. –  Martin Jul 20 '12 at 6:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.