hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brooks, Kenneth S" <kenneth.s.bro...@chase.com>
Subject RE: monitoring active connection
Date Wed, 19 May 2010 01:25:07 GMT
Sounds good.. 
I'll take it and go chew on it a bit and see what I can come up with..

Thanks for the response
-k

-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Tuesday, May 18, 2010 4:23 PM
To: HttpClient User Discussion
Subject: Re: monitoring active connection

On Tue, 2010-05-18 at 08:13 -0400, Brooks, Kenneth S wrote:
> Awhile ago I mentioned that we have an issue where the following will happen to a single
request out of millions and millions.
> The message is sent by httpclient.
> Server receives the message.
> Server (claims to) send the response.
> Httpclient never sees it again.
> 
> Even with the socket timeout set to minutes the response never makes it to the client.
> Then we get a Socket timeout exception: read timed out.
> 
> I asked if it was possible to keep track of open connections and if any particular thread
was still active after XXX amount of time then be able to call some custom code.
> That way we can possibly inspect the running VM and not just logs after it has happened.
> 
> Oleg, you said that it wasn't really possible with httpclient 3 but it is with 4 and
I've since been able to upgrade to 4.. What did you have in mind that would allow me to do
this?
> 

HttpClient 4.0 framework allows for a custom connection implementation
to be used instead of the standard one, which is not possible with
HttpClient 3.x.   

http://hc.apache.org/httpcomponents-client-4.0.1/tutorial/html/advanced.html#d4e1063

HttpClient 4.0 maintains some basic statistics about the usage of a
connection out of the box such as the total number of requests executed,
responses received and total bytes sent and received:

http://hc.apache.org/httpcomponents-core/httpcore/apidocs/org/apache/http/HttpConnection.html#getMetrics%28%29
http://hc.apache.org/httpcomponents-core/httpcore/apidocs/org/apache/http/HttpConnectionMetrics.html


One possibility may be to extend the standard connection class and
provide additional connection data such as the time of creation, last
time accessed and what not. These attributes can be used by the
connection manager to decide whether or not the connection should be
reused. You could also extend the standard connection manager and make
it expose these details though a custom API of some sort.

Hope this helps

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law.  If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED.  Although this transmission and
any attachments are believed to be free of any virus or other
defect that might affect any computer system into which it is
received and opened, it is the responsibility of the recipient to
ensure that it is virus free and no responsibility is accepted by
JPMorgan Chase & Co., its subsidiaries and affiliates, as
applicable, for any loss or damage arising in any way from its use.
 If you received this transmission in error, please immediately
contact the sender and destroy the material in its entirety,
whether in electronic or hard copy format. Thank you.
Mime
View raw message