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: Question about pools
Date Fri, 15 Jun 2012 15:40:46 GMT
On Thu, 2012-06-14 at 13:08 +0200, Joan Balaguero wrote:
> Hello,
> 
>  
> 
> I have a servlet that acts as a http proxy. It manages 20 webservices, and
> each webservice has its own Multithreaded pool. The total number of
> concurrent connections is not higher than 2.000.
> 
>  
> 
> I’m thinking to use just one pool for all 20 webservices. 
> 
>  
> 
> I’ve not made any tests yet, but what would be the advantages and
> disadvantages of using just one pool?
> 
>  
> 
> I suppose that I’ll earn resources (thread pools, etc) but this 2000
> requests, that now are shared among 20 pools,  they’ll be served by just one
> pool. Can I find any lock contentions or something that makes this change
> not recommendable? Anyone using a pool with 2000 (or more) concurrent
> requests? Or maybe I should try asyncHttpClient with this level of requests.
> 
>  
> 

Joan

It really depends on several factors. Connections pools in HttpClient
4.x are protected with one global lock per pool. So, the larger the pool
the more likely are chances of lock contention. However, as long as the
number of worker threads is approximately the same as the max number of
connections per route, the lock should get acquired and released
reasonably fast. 

At the same time if all your web services are hosted on different hosts
with distinct connection routes, connections cannot be shared between
endpoints, so you might as well have separate pools of connections for
each individual service.

Oleg



> Thanks,
> 
> Joan.
> 



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