You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Oleg Kalnichevski <ol...@apache.org> on 2013/10/18 11:49:04 UTC

Re: Understanding and configuring in HttpAsyncClient 4.0-beta4

On Thu, 2013-10-17 at 21:46 -0700, Jaikit Savla wrote:
> Hello Mates,
> 
> 1. In RequestConfig: What is the difference between ConnectTimeout and ConnectionRequestTimeout ?
> From quick look at code - I concluded that ConnectTimeout is "timeout when client tries to connect to server" and ConnectionRequestTimeout is "timeout when request can be considered expired". 
> 
>

ConnectTimeout - maximum period of inactivity while TCP connection is
being negotiated. 

ConnectionRequestTimeout - maximum period of inactivity waiting on a
connection lease request. Used to be called connection manager timeout. 

> 2. How can I set connection manager timeout ? This time out implies if all connections are busy/leased, it will wait for specified time in queue before returning timeout error. Please correct if my understanding is wrong.
>  Previously I used httpparams to do that. But now httpparams seems to be have deprecated.
> // timeout waiting for a connection from the connection manager. 
> httpParams.setParameter("http.connection-manager.timeout", (int) config.getConnectionManagerTimeout()
>         .toMillis());
> 

See above.

> 3. How can I set HttpVersion ?
> HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);
> 

One can set a desired protocol version directly on request message
instances. The parameter is completely superfluous.  

> 4. Also I noticed that socket/connection timeouts are configured at multiple places. Hence would like to make sure what is best practice to configure them. Should we set at all below 3 places ?
> 1. IOReactorConfig has sockettimeout and connection timeout 
> 2. SocketConfig which can be set to PoolingNHttpClientConnectionManager
> 3. RequestConfig - also has both Socket and Connection timeout setting.
> 

1. IOReactorConfig defines global (client level) defaults used by the
I/O reactor when initializing new connections
2. No longer supported as of 4.0 GA
3. RequestConfig represents request level parameters. Socket and connect
timeout values, if non-zero, override those used by default.

Hope this helps

Oleg



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


Re: Understanding and configuring in HttpAsyncClient 4.0-beta4

Posted by Jaikit Savla <ja...@yahoo.com>.
This definitely helps. Thanks a lot!



On Friday, October 18, 2013 2:49 AM, Oleg Kalnichevski <ol...@apache.org> wrote:
 
On Thu, 2013-10-17 at 21:46 -0700, Jaikit Savla wrote:
> Hello Mates,
> 
> 1. In RequestConfig: What is the difference between ConnectTimeout and ConnectionRequestTimeout ?
> From quick look at code - I concluded that ConnectTimeout is "timeout when client tries to connect to server" and ConnectionRequestTimeout is "timeout when request can be considered expired". 
> 
>

ConnectTimeout - maximum period of inactivity while TCP connection is
being negotiated. 

ConnectionRequestTimeout - maximum period of inactivity waiting on a
connection lease request. Used to be called connection manager timeout. 

> 2. How can I set connection manager timeout ? This time out implies if all connections are busy/leased, it will wait for specified time in queue before returning timeout error. Please correct if my understanding is wrong.
>  Previously I used httpparams to do that. But now httpparams seems to be have deprecated.
> // timeout waiting for a connection from the connection manager. 
> httpParams.setParameter("http.connection-manager.timeout", (int) config.getConnectionManagerTimeout()
>         .toMillis());
> 

See above.

> 3. How can I set HttpVersion ?
> HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);
> 

One can set a desired protocol version directly on request message
instances. The parameter is completely superfluous.  


> 4. Also I noticed that socket/connection timeouts are configured at multiple places. Hence would like to make sure what is best practice to configure them. Should we set at all below 3 places ?
> 1. IOReactorConfig has sockettimeout and connection timeout 
> 2. SocketConfig which can be set to PoolingNHttpClientConnectionManager
> 3. RequestConfig - also has both Socket and Connection timeout setting.
> 

1. IOReactorConfig defines global (client level) defaults used by the
I/O reactor when initializing new connections
2. No longer supported as of 4.0 GA
3. RequestConfig represents request level parameters. Socket and connect
timeout values, if non-zero, override those used by default.

Hope this helps

Oleg