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 Algirdas Veitas <ap...@gmail.com> on 2008/07/17 01:19:51 UTC

Long wait times in MultiThreadedHttpConnectionManager.doGetConnection(...)

Hi,

Our application is using HttpClient 3.0.1 and is experiencing "long wait
times" (started happening recently it seems) in the method
MultiThreadedHttpConnectionManager.doGetConnection(...).  To give a summary
of the application, we have a bunch of threads (message driven beans, JBoss
4.0.2, JDK 1.4)  that are processing a message, creating xml out of it and
then sending the xml over an HTTP Post.  The HTTP Post is always to one
static URL and the target web server is IIS.  Threads are running
concurrently and have a cap of 30 in the pool, all threads are pretty much
constantly processing a request.    We release the connection in our finally
block (if (postMethod != null) { postMethod.releaseConnection(); } )

As an example of the long wait times, we profiled one of our worker threads
and it took 3781 ms to process a message and do the HTTP Post. Out of the
3781 ms, 3628 ms are within
MultiThreadedHttpConnectionManager.doGetConnection(...) versus 67 ms to
perform the actual HTTP Post (via PostMethod.execute()).

Our profiler shows that methods called within
MultiThreadedHttpConnectionManager.doGetConnectiont(...) take no more than 1
ms.

Not sure what to make of this at this point, but it seems strange that there
is such a long wait time. We wire up the HttpClient configuration via
Spring, but essentially it looks like this:

httpConnectionManagerParams.setMaxConnections(40);
httpConnectionManagerParams.setSoTimeOut(1500);
multiThreadedHttpConnectionManager.setParams(httpConnectionManagerParams);

httpClient.setHttpConnectionManager(multiThreadedHttpConnectionManager);

Has anyone experienced such behavior before?  Perhaps need to fine tune the
configuration?

Please let me know if more information is needed, will certainly provide it.

Thanks,
Al

Re: Long wait times in MultiThreadedHttpConnectionManager.doGetConnection(...)

Posted by Algirdas Veitas <av...@allesta.com>.
Hi Oleg,

Many thanks for the guidance, working much better now :)

Al

On Thu, Jul 17, 2008 at 2:56 PM, Oleg Kalnichevski <ol...@apache.org> wrote:

> On Wed, 2008-07-16 at 16:19 -0700, Algirdas Veitas wrote:
> > Hi,
> >
> > Our application is using HttpClient 3.0.1 and is experiencing "long wait
> > times" (started happening recently it seems) in the method
> > MultiThreadedHttpConnectionManager.doGetConnection(...).  To give a
> summary
> > of the application, we have a bunch of threads (message driven beans,
> JBoss
> > 4.0.2, JDK 1.4)  that are processing a message, creating xml out of it
> and
> > then sending the xml over an HTTP Post.  The HTTP Post is always to one
> > static URL and the target web server is IIS.  Threads are running
> > concurrently and have a cap of 30 in the pool, all threads are pretty
> much
> > constantly processing a request.    We release the connection in our
> finally
> > block (if (postMethod != null) { postMethod.releaseConnection(); } )
> >
> > As an example of the long wait times, we profiled one of our worker
> threads
> > and it took 3781 ms to process a message and do the HTTP Post. Out of the
> > 3781 ms, 3628 ms are within
> > MultiThreadedHttpConnectionManager.doGetConnection(...) versus 67 ms to
> > perform the actual HTTP Post (via PostMethod.execute()).
> >
> > Our profiler shows that methods called within
> > MultiThreadedHttpConnectionManager.doGetConnectiont(...) take no more
> than 1
> > ms.
> >
> > Not sure what to make of this at this point, but it seems strange that
> there
> > is such a long wait time. We wire up the HttpClient configuration via
> > Spring, but essentially it looks like this:
> >
> > httpConnectionManagerParams.setMaxConnections(40);
> > httpConnectionManagerParams.setSoTimeOut(1500);
> >
> multiThreadedHttpConnectionManager.setParams(httpConnectionManagerParams);
> >
> > httpClient.setHttpConnectionManager(multiThreadedHttpConnectionManager);
> >
> > Has anyone experienced such behavior before?  Perhaps need to fine tune
> the
> > configuration?
> >
> > Please let me know if more information is needed, will certainly provide
> it.
> >
> > Thanks,
> > Al
>
> Per default HttpClient uses only two simultaneous connections to the
> same host regardless of how many total connections are allowed. Try
> increasing the number of maximum connections per 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
>
>

Re: Long wait times in MultiThreadedHttpConnectionManager.doGetConnection(...)

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2008-07-16 at 16:19 -0700, Algirdas Veitas wrote:
> Hi,
> 
> Our application is using HttpClient 3.0.1 and is experiencing "long wait
> times" (started happening recently it seems) in the method
> MultiThreadedHttpConnectionManager.doGetConnection(...).  To give a summary
> of the application, we have a bunch of threads (message driven beans, JBoss
> 4.0.2, JDK 1.4)  that are processing a message, creating xml out of it and
> then sending the xml over an HTTP Post.  The HTTP Post is always to one
> static URL and the target web server is IIS.  Threads are running
> concurrently and have a cap of 30 in the pool, all threads are pretty much
> constantly processing a request.    We release the connection in our finally
> block (if (postMethod != null) { postMethod.releaseConnection(); } )
> 
> As an example of the long wait times, we profiled one of our worker threads
> and it took 3781 ms to process a message and do the HTTP Post. Out of the
> 3781 ms, 3628 ms are within
> MultiThreadedHttpConnectionManager.doGetConnection(...) versus 67 ms to
> perform the actual HTTP Post (via PostMethod.execute()).
> 
> Our profiler shows that methods called within
> MultiThreadedHttpConnectionManager.doGetConnectiont(...) take no more than 1
> ms.
> 
> Not sure what to make of this at this point, but it seems strange that there
> is such a long wait time. We wire up the HttpClient configuration via
> Spring, but essentially it looks like this:
> 
> httpConnectionManagerParams.setMaxConnections(40);
> httpConnectionManagerParams.setSoTimeOut(1500);
> multiThreadedHttpConnectionManager.setParams(httpConnectionManagerParams);
> 
> httpClient.setHttpConnectionManager(multiThreadedHttpConnectionManager);
> 
> Has anyone experienced such behavior before?  Perhaps need to fine tune the
> configuration?
> 
> Please let me know if more information is needed, will certainly provide it.
> 
> Thanks,
> Al

Per default HttpClient uses only two simultaneous connections to the
same host regardless of how many total connections are allowed. Try
increasing the number of maximum connections per 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