You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Mohit Anchlia <mo...@gmail.com> on 2012/04/24 16:46:14 UTC

Monitoring connections

We are few times a day see high response times and we suspect it might have
to do with firewall dropping connection because of tcp keep alive. Even
though we have set to expire connection before that, I would still like to
confirm that this is not an issue. Is there a easy way to monitor how long
it takes for the httpclient to create a new connection or if it first
timedout because of dropped connection and then created a new connection?
This is in production so would like to know the safest approach.

Re: Monitoring connections

Posted by Mohit Anchlia <mo...@gmail.com>.
On Wed, Apr 25, 2012 at 5:32 AM, Oleg Kalnichevski <ol...@apache.org> wrote:

> On Tue, 2012-04-24 at 15:49 -0700, Mohit Anchlia wrote:
> > On Tue, Apr 24, 2012 at 2:38 PM, Oleg Kalnichevski <ol...@apache.org>
> wrote:
> >
> > >  On Tue, 2012-04-24 at 07:46 -0700, Mohit Anchlia wrote:
> > > > We are few times a day see high response times and we suspect it
> might
> > > have
> > > > to do with firewall dropping connection because of tcp keep alive.
> Even
> > > > though we have set to expire connection before that, I would still
> like
> > > to
> > > > confirm that this is not an issue. Is there a easy way to monitor how
> > > long
> > > > it takes for the httpclient to create a new connection or if it first
> > > > timedout because of dropped connection and then created a new
> connection?
> > > > This is in production so would like to know the safest approach.
> > >
> > > You can create a custom SchemeSocketFactory implementation or decorate
> > > one of the existing ones and measure the time elapsed in #connectSocket
> > > method in order to find out how long it took to establish connection to
> > > the remote host.
> > >
> > >
> > Thanks! Is the retry mechanism because of bad socket built in this
> method?
> > If there is a dropped connection by firewall, is that seamlessly taken
> care
> > of by this method? Or does it try to take another connection from the
> pool.
> > We use pool of connections.
> >
> >
>
> No, there is not retrial logic in the default implementations of
> SchemeSocketFactory. Connect and request execution retrial is handled by
> DefaultRequestDirector class.
>
>
Is this always in use by default? If I monitor something on
DefaultRequestDirector class I would be able to see the problem I described
related to firewall dropping connections?

Does httpclient have something similar to ping/pong of mod_jk where
connection gets pinged so often in the background to see if it still is
alive?


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

Re: Monitoring connections

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2012-04-24 at 15:49 -0700, Mohit Anchlia wrote:
> On Tue, Apr 24, 2012 at 2:38 PM, Oleg Kalnichevski <ol...@apache.org> wrote:
> 
> >  On Tue, 2012-04-24 at 07:46 -0700, Mohit Anchlia wrote:
> > > We are few times a day see high response times and we suspect it might
> > have
> > > to do with firewall dropping connection because of tcp keep alive. Even
> > > though we have set to expire connection before that, I would still like
> > to
> > > confirm that this is not an issue. Is there a easy way to monitor how
> > long
> > > it takes for the httpclient to create a new connection or if it first
> > > timedout because of dropped connection and then created a new connection?
> > > This is in production so would like to know the safest approach.
> >
> > You can create a custom SchemeSocketFactory implementation or decorate
> > one of the existing ones and measure the time elapsed in #connectSocket
> > method in order to find out how long it took to establish connection to
> > the remote host.
> >
> >
> Thanks! Is the retry mechanism because of bad socket built in this method?
> If there is a dropped connection by firewall, is that seamlessly taken care
> of by this method? Or does it try to take another connection from the pool.
> We use pool of connections.
> 
> 

No, there is not retrial logic in the default implementations of
SchemeSocketFactory. Connect and request execution retrial is handled by
DefaultRequestDirector class.

Oleg



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


Re: Monitoring connections

Posted by Mohit Anchlia <mo...@gmail.com>.
On Tue, Apr 24, 2012 at 2:38 PM, Oleg Kalnichevski <ol...@apache.org> wrote:

>  On Tue, 2012-04-24 at 07:46 -0700, Mohit Anchlia wrote:
> > We are few times a day see high response times and we suspect it might
> have
> > to do with firewall dropping connection because of tcp keep alive. Even
> > though we have set to expire connection before that, I would still like
> to
> > confirm that this is not an issue. Is there a easy way to monitor how
> long
> > it takes for the httpclient to create a new connection or if it first
> > timedout because of dropped connection and then created a new connection?
> > This is in production so would like to know the safest approach.
>
> You can create a custom SchemeSocketFactory implementation or decorate
> one of the existing ones and measure the time elapsed in #connectSocket
> method in order to find out how long it took to establish connection to
> the remote host.
>
>
Thanks! Is the retry mechanism because of bad socket built in this method?
If there is a dropped connection by firewall, is that seamlessly taken care
of by this method? Or does it try to take another connection from the pool.
We use pool of connections.


> 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
>
>

Re: Monitoring connections

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2012-04-24 at 07:46 -0700, Mohit Anchlia wrote:
> We are few times a day see high response times and we suspect it might have
> to do with firewall dropping connection because of tcp keep alive. Even
> though we have set to expire connection before that, I would still like to
> confirm that this is not an issue. Is there a easy way to monitor how long
> it takes for the httpclient to create a new connection or if it first
> timedout because of dropped connection and then created a new connection?
> This is in production so would like to know the safest approach.

You can create a custom SchemeSocketFactory implementation or decorate
one of the existing ones and measure the time elapsed in #connectSocket
method in order to find out how long it took to establish connection to
the remote host.
        
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