14

The Apache Httpd manual has a section on custom access log formats. One of these options is the %D field, which is documented as

The time taken to serve the request, in microseconds.

Can anyone tell me what exactly this is measuring? Is it time-to-first-byte, or time-to-last-byte, for example, or something more complex than that?

I need this is demonstrate compliance to performance requirements, and I want to know exactly what's being measured here.

skaffman
  • 398,947
  • 96
  • 818
  • 769
  • I realize it has been 11 years since you were thinking about this. If I am reading this right your question is about when does the timer stop. I am interested in when the timer starts. Do you start the timer when you read the first byte of the request or when you have read the entire request? Do you know? – bhspencer Oct 12 '22 at 14:58

3 Answers3

16

It's the last byte or rather, apr_time_now() - request_rec->request_time which is worked out during the logging phase. That phase happens last in the processing cycle, after the response has been sent.

Harold
  • 103
  • 4
noodl
  • 17,143
  • 3
  • 57
  • 55
  • 1
    If you are looking for time to first byte (TTFB) it seems that since Apache 2.4.13 you can use [%^FB available in module mod_logio](https://httpd.apache.org/docs/2.4/mod/mod_logio.html) – Nils Nov 14 '16 at 09:29
6

http://code.google.com/p/mod-log-firstbyte/ seems to imply that %D measures the time to last byte, whereas mod-log-firstbyte measures the time to first byte.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
  • Ah, that looks very useful. "time-to-first-byte" is generally what makes the user-experience better. – skaffman Jan 19 '11 at 12:35
2

Both values are useful to know for performance debugging. Time to first byte is the wait time or latency of the connection, while %D also includes the transfer time. The total time is what you use for overall performance and capacity planning, while the wait is what you try to minimize.

davecb
  • 284
  • 3
  • 7