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 Uwe Kubosch <uw...@kubosch.no> on 2008/03/20 18:19:27 UTC

Getting the response time for multithreaded client

Hi all!

We are using the Commons HttpClient in a multithreaded application, and
frequently there are more threads trying to use the client than the
limit set by setMaxConnectionsPerHost.

In this situation we still need to log the response time from the
server.  How can we do that?  Measuring the Method.executeMethod call
includes the time the thread sleeps before actually submitting the
request.

We are currently using Commons HttpClient 3.1 which I believe is the
latest stable release.

Any help is greatly appreciated, even quick fixes and hacks :)


Uwe


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


Re: Getting the response time for multithreaded client

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2008-03-24 at 22:19 +0100, Uwe Kubosch wrote:
> Hi Oleg!
> 
> Thank you for your answer.
> 
> How would I do it in HttpClient 4.0?

The simplest way would be to register a request interceptor to log the
start time of the request execution and a response interceptor to log
the time a response head (but not the response body) has been received


>   Could you write a minimal example?
> 

Yes I could, but this example should be good enough to get you started

http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientGZipContentCompression.java


> How reliable is HttpClient 4.0 compared to HttpClient 3.1?
> 
> 

Depends on your definition of reliability. 4.0 is certainly not API
stable yet.

Oleg 


> Uwe
> 
> 
> On Mon, 2008-03-24 at 20:37 +0100, Oleg Kalnichevski wrote:
> > On Thu, 2008-03-20 at 18:19 +0100, Uwe Kubosch wrote:
> > > Hi all!
> > > 
> > > We are using the Commons HttpClient in a multithreaded application, and
> > > frequently there are more threads trying to use the client than the
> > > limit set by setMaxConnectionsPerHost.
> > > 
> > > In this situation we still need to log the response time from the
> > > server.  How can we do that?  Measuring the Method.executeMethod call
> > > includes the time the thread sleeps before actually submitting the
> > > request.
> > > 
> > > We are currently using Commons HttpClient 3.1 which I believe is the
> > > latest stable release.
> > > 
> > 
> > Uwe,
> > 
> > There is no way around either upgrading to HttpClient 4.0, which has a
> > massively better, modular architecture or hacking the source code of
> > HttpClient 3.x  
> > 
> > Oleg
> > 
> > > Any help is greatly appreciated, even quick fixes and hacks :)
> > > 
> > > 
> > > Uwe
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 


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


Re: Getting the response time for multithreaded client

Posted by Uwe Kubosch <uw...@kubosch.no>.
Hi Oleg!

Thank you for your answer.

How would I do it in HttpClient 4.0?  Could you write a minimal example?

How reliable is HttpClient 4.0 compared to HttpClient 3.1?


Uwe


On Mon, 2008-03-24 at 20:37 +0100, Oleg Kalnichevski wrote:
> On Thu, 2008-03-20 at 18:19 +0100, Uwe Kubosch wrote:
> > Hi all!
> > 
> > We are using the Commons HttpClient in a multithreaded application, and
> > frequently there are more threads trying to use the client than the
> > limit set by setMaxConnectionsPerHost.
> > 
> > In this situation we still need to log the response time from the
> > server.  How can we do that?  Measuring the Method.executeMethod call
> > includes the time the thread sleeps before actually submitting the
> > request.
> > 
> > We are currently using Commons HttpClient 3.1 which I believe is the
> > latest stable release.
> > 
> 
> Uwe,
> 
> There is no way around either upgrading to HttpClient 4.0, which has a
> massively better, modular architecture or hacking the source code of
> HttpClient 3.x  
> 
> Oleg
> 
> > Any help is greatly appreciated, even quick fixes and hacks :)
> > 
> > 
> > Uwe
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 


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


Re: Getting the response time for multithreaded client

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2008-03-20 at 18:19 +0100, Uwe Kubosch wrote:
> Hi all!
> 
> We are using the Commons HttpClient in a multithreaded application, and
> frequently there are more threads trying to use the client than the
> limit set by setMaxConnectionsPerHost.
> 
> In this situation we still need to log the response time from the
> server.  How can we do that?  Measuring the Method.executeMethod call
> includes the time the thread sleeps before actually submitting the
> request.
> 
> We are currently using Commons HttpClient 3.1 which I believe is the
> latest stable release.
> 

Uwe,

There is no way around either upgrading to HttpClient 4.0, which has a
massively better, modular architecture or hacking the source code of
HttpClient 3.x  

Oleg

> Any help is greatly appreciated, even quick fixes and hacks :)
> 
> 
> Uwe
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 


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