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: Proper Use of HTTPClient 3.x for Many Hosts
Date Sat, 24 Jan 2009 12:55:16 GMT
On Fri, 2009-01-23 at 11:45 -0800, joeweder wrote:
> I have a application that will talk to several hosts (from 1 to 25). For each
> host, it will make repeated (timed interval) ongoing GETs and POSTs to a few
> ports.
> QUESTION: What is the recommended usage of the
> HttpClient/HttpConnectionManager for this scenario?
> Do I use a single HttpConnectionManager for each host (20 hosts ==> 20 HCM)?
> Or, can I reuse one HttpConnectionManager and talk to more than one host (20
> host ==> 1 HCM)?

Yes, you can (and should) reuse one connection manager. 

> I am reasonably certain that I need to use the
> MultiThreadedHttpConnectionManager.
> What I think is that I'd create one connection manager and create a single
> HttpClient instance for each host/port combination... like below:
> HttpConnectionManager      HttpClientHost1Port3331
>                                       HttpClientHost1Port8080
>                                       HttpClientHost2Port3331
>                                       HttpClientHost2Port8080
>                                       ...
> Agree/Disagree?

This will not result in any tangle benefit I can think of. A single
HttpClient instance should be perfectly okay.

> I see lots of posts about this but I am not 100% sure about the answer for
> my scenario.
> Thanks for any feedback in advance. 
> NOTE: I want to solve this with 3.x and then move to 4.x

4.0 has a massively better connection management. If you plan to migrate
soon, skip 3.x altogether.


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

View raw message