hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Speirs <wspe...@apache.org>
Subject Re: httpclient.defaultMaxPerRoute and maxTotalConnections questions
Date Tue, 06 Dec 2011 21:42:47 GMT
On Tue, Dec 6, 2011 at 1:30 PM, mpindyala <mohan.pindyala@rovicorp.com> wrote:
>> Yes , its just a thread .  We did this to save 10-30ms for each http
>> request that application does to back end providers. It seems connection
>> manager takes 10-30ms just to close idle and expired connections before
>> they can be reused.  Please let us know if there are any pitfalls of doing
>> this.

I don't know if this makes sense... if the connection is idle it can
be re-used for another request, why would you close it? You can
however set the max amount of time the ThreadSafeClientConnManager
will keep a connection open for:
http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.html#ThreadSafeClientConnManager(org.apache.http.conn.scheme.SchemeRegistry,
long, java.util.concurrent.TimeUnit)

>> The reason we set those numbers high as a protection, our third responds
>> within 500ms most of the time.
>> It is just when there is something going on between hops , the delay is
>> seem.
>> So one questions which still needs clarification is
>>  httpclient.defaultMaxPerRoute = 10000
>> httpclient.maxTotalConnections = 20000
>>
>> is defaultMaxPerRoute  is per third party service we are calling ? if yes
>> then
>> if there are 4 services we have to call then settings should be
>> httpclient.defaultMaxPerRoute = 10000
>> httpclient.maxTotalConnections = 40000
>> Each route getting 10000 , is that assumption correct ?

I would need Oleg to verify (or spend more time than I want checking
the source), but these are different things. From the docs for
ConnPoolByRoute
(http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.html),
"connections are re-used only for the exact same route" & "connection
limits are enforced per route rather than per host". So as I
understand it a route and a host/connection are NOT the same thing. So
you could have 4 as your MaxPerRoute and 1 as your
maxTotalConnections... I don't think maxPerRoute >
maxTotalConnections.

>> we want to support upto 4M per hour

Depending upon a lot of factors 4M per hour should be doable... I've
been able to get 65K per sec.

Bill-

---------------------------------------------------------------------
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