hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Long wait times in MultiThreadedHttpConnectionManager.doGetConnection(...)
Date Thu, 17 Jul 2008 21:56:09 GMT
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


Mime
View raw message