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 David Byrne <da...@yahoo.com> on 2008/04/19 02:50:24 UTC

Connection Management in HttpClient 4

This question is in regards to HttpClient 4. 

I seem to be having a problem with ThreadSafeClientConnManager, or ConnPoolByRoute.getEntry more specifically. For testing purposes, I have set the MAX_HOST_CONNECTIONS and MAX_TOTAL_CONNECTIONS to 100, and confirmed that the correct values are being used in getEntry. 

Despite these high values, I have a large number of threads that sit on the call to WaitingThread.await. I haven’t timed how long they are sitting there, but when I pause execution in a debugger, at least 80% of my 20+ threads are paused there. Using netstat, I never see more than five established connections to the server, and rarely more than four. A packet capture shows that no connections are being rejected by the server.

Any ideas about what I’m doing wrong?

Thanks,
David Byrne






      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

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


Re: Connection Management in HttpClient 4

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2008-04-18 at 17:50 -0700, David Byrne wrote:
> This question is in regards to HttpClient 4. 
> 
> I seem to be having a problem with ThreadSafeClientConnManager, or ConnPoolByRoute.getEntry more specifically. For testing purposes, I have set the MAX_HOST_CONNECTIONS and MAX_TOTAL_CONNECTIONS to 100, and confirmed that the correct values are being used in getEntry. 
> 
> Despite these high values, I have a large number of threads that sit on the call to WaitingThread.await. I haven’t timed how long they are sitting there, but when I pause execution in a debugger, at least 80% of my 20+ threads are paused there. Using netstat, I never see more than five established connections to the server, and rarely more than four. A packet capture shows that no connections are being rejected by the server.
> 
> Any ideas about what I’m doing wrong?
> 
> Thanks,
> David Byrne
> 
> 

David,

Please get the latest code out of SVN or Maven snapshot repository 

http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/
http://people.apache.org/repo/m2-snapshot-repository/org/apache/httpcomponents/httpclient/4.0-alpha4-SNAPSHOT/

Run your application with the following JVM properties

-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.log.org.apache.http.impl.conn=DEBUG

This should produce a detailed context log about connection pooling.
Feel free to post the log to this list if you need help interpreting it.

Hope this helps

Oleg


> 
> 
> 
> 
>       ____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> 
> ---------------------------------------------------------------------
> 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