hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnijjhar <baljeet.nijj...@accenture.com>
Subject Is it good practice to set the connection timeout for ThreadSafeClientConnManager implementation?
Date Mon, 04 Jul 2011 09:17:47 GMT

I've set the socket timeout for my DefaultHttpClient 4.1.1. However, I'm
unsure whether to set the connection timeout. It seems that for an
HttpClient using the ThreadSafeClientConnManager, the threads are
effectively waiting for a connection from the connection manager's pool
(rather than whether the connection has been established). So if the
connection manager does not manage to establish the connection within the
connection timeout (e.g. 100 ms) for the first thread, then the second
thread which might have been waiting from about the same time as the first
thread, receives a timeout almost immediately (instead of the connection
manager trying again and giving a timeout 100 ms later). I feel that if the
size of the connection pool was not tuned carefully, or there was a sudden
peak in threads, this would result in threads being timed out just because
threads before them were timing out also.
Does anyone have any advice? In HttpClient 3.1, there seemed to be two sets
of parameters, one for the connection manager to establish the connection,
and one for the HttpClient to get a connection from the connection manager
(as described in this link
http://brian.olore.net/wp/2009/08/apache-httpclient-timeout/) and I think I
just want the former?
View this message in context: http://old.nabble.com/Is-it-good-practice-to-set-the-connection-timeout-for-ThreadSafeClientConnManager-implementation--tp31987905p31987905.html
Sent from the HttpClient-User mailing list archive at Nabble.com.

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

View raw message