Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] client: getting pooled connection / destination statistics

Hi,

On Thu, Sep 14, 2017 at 7:47 PM, Steven Schlansker
<stevenschlansker@xxxxxxxxx> wrote:
> I'm going through the process of upgrading from Apache HttpClient 4 to Jetty HttpClient -- we got tired
> of dealing with terrible APIs and wanted asynchronous support :)
>
> One thing I've not been able to figure out is how do I instrument the Jetty client to get
> statistics out - number of connections used / available in pools; open connections
> to each destination versus the limit, etc.
>
> Didn't see a mention in the docs nor any obvious API, but I'm sure I'm just missing it.

This information is automatically exposed to JMX when using Jetty's
JMX facilities.

Otherwise it is obtainable by downcasting to concrete classes:

HttpDestination destination = (HttpDestination)httpClient.getDestination(...);
DuplexConnectionPool connectionPool =
(DuplexConnectionPool)destination.getConnectionPool();

You may get different concrete classes based on the transport you have
chosen, so maybe you need additional "instanceof" around.

HttpDestination and DuplexConnectionPool (and their parent classes)
have methods annotated with @ManagedAttribute and those are exported
to JMX and are probably those you're interested in.

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


Back to the top