Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] tracking request wait time

Hi,

On Wed, Feb 15, 2023 at 5:17 PM Matthias Sohn <matthias.sohn@xxxxxxxxx> wrote:
> We tried that and also enabled debug log on AbstractConnection and we found this:
>
> [2023-02-15T16:44:07.580+01:00] [HTTP-56] DEBUG org.eclipse.jetty.io.AbstractConnection : onOpen HttpConnection@9aa795c::SocketChannelEndPoint@4332687d ...
> [2023-02-15T16:44:07.580+01:00] [HTTP-56] DEBUG org.eclipse.jetty.io.AbstractConnection : fillInterested HttpConnection@9aa795c::SocketChannelEndPoint@4332687d ...
> [2023-02-15T16:44:07.581+01:00] [HTTP-53] DEBUG com.google.gerrit.pgm.http.jetty.JettyHttpChannelListener : [HTTP-53] onRequestBegin Request(GET //localhost:8080/a/accounts/self)@76a10e41
> [2023-02-15T16:44:07.581+01:00] [HTTP-53] DEBUG com.google.gerrit.pgm.http.jetty.JettyHttpChannelListener : [HTTP-53] onBeforeDispatch Request(GET //localhost:8080/a/accounts/self)@76a10e41
> [2023-02-15T16:44:07.588+01:00] [HTTP-53] DEBUG org.eclipse.jetty.io.AbstractConnection : onClose HttpConnection@9aa795c::SocketChannelEndPoint@4332687d ...
>
> The events we can listen to via HttpChannel.Listener are all on the worker thread processing the request.

In your case, yes.

> Is there a chance to measure the time between accepting the request on the connection/establishing the connection
> and when it's dispatched to the worker thread (onRequestBegin)?

There is no relationship, as connections are typically reused for
multiple requests.
You can access the endpoint epoch time via:

request.getHttpChannel().getEndPoint().getCreatedTimeStamp()

That will give you the "connection" epoch time, but then it is
practically useless if the connection is reused (and I hope you do
reuse connections, otherwise you have bigger problems to tackle
first).

> We are interested in that since we sometimes see a large discrepancy between the time logged in haproxy
> running in front of Gerrit and the corresponding execution time logged by Gerrit.

Make sure you are using persistent connections and HTTP/1.1 (not HTTP/1.0).

> Gerrit also supports ssh protocol using Apache Mina sshd and there we can get this wait time between
> a request being accepted and the start of processing the request.

Not sure what you mean by "request being accepted"?

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top