hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastiano Vigna <vi...@di.unimi.it>
Subject Re: When does a connection get closed when using a DefaultConnectionReuseStrategy?
Date Wed, 13 Nov 2013 15:48:44 GMT

On 13 Nov 2013, at 4:43 PM, Oleg Kalnichevski <olegk@apache.org> wrote:

> On Wed, 2013-11-13 at 14:35 +0100, Sebastiano Vigna wrote:
>> Question: when a connection opened with DefaultConnectionReuseStrategy will be actually
closed? When the same client is used with a different host? Or is there some explicit operation
that must be done to close the connection?
> I am not sure I understand the question. Do you mean when a connection
> kept alive in the pool gets closed when expired?


We use the following client:

		httpClient = HttpClients.custom()
				.setConnectionManager( connManager )
				.setConnectionReuseStrategy( DefaultConnectionReuseStrategy.INSTANCE )

Now, after we do a number of consecutive fetches form the same host, we know that it won't
happen for several seconds, or even minutes. We don't want the client to keep the connection
open after we completed our fetch cycle. We download in parallel from hundreds of thousands
of hosts at several thousand pages per second, so we cannot leave open connection around or
we risk to exaust the ports.

How can we be sure that the TCP connection with a host is shut down immediately, after we
finish our batch of consecutive fetches?



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

View raw message