Hi Chris,

On 29/09/2025 17:57, Christopher Schultz wrote:
All,

There has been a few conversations and some nice work lately on adding nanosecond resolution to response-time measurements.

I wonder about what is being measured, though.

When a request is made, the TCP connection experiences several different phases:

1. Sitting in the OS's accept queue

2. Sitting in Tomcat's accept queue (this is after accept() returns and the request is added to our internal work-queue, but before a request- processing thread begins processing the request)

3. Being actively processed by a Tomcat service thread

I'm fairly sure that we are only actually measuring #3 when reporting response-time in access logs.

Yes. Timing starts (for HTTP/1.1 anyway) when the first byte of the request is read.

Would it be possible to add #2 as well?

Yes. Recording the request start time would need to move to the SocketWrapper but it could be done.

I think it's impossible to add #1 because all of that happens before Java even gets a look at the request.

Agreed.

This may be more of a question of perception than anything else... while we /can/ measure response-time in ns, now... perhaps we are lying to ourselves about the actual experience of the client.

Actually doing something with the nanosecond resolution we now have is still on my TODO list. I question how useful it would be - even at microsecond resolution but the users asking for it are convinced it will be useful and as - so far - it has improved rather than reduced performance I'm not going to object.


Whether we want to include 2 in the request processing time is TBD. I'm not sure. I think a good first step would be to add some detail to the access log documentation so it is clear to folks exactly when timing starts and ends.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to