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 Joan Balagueró <jo...@grupoventus.com> on 2016/10/07 13:03:44 UTC

Socket timeout in the async http client

Hello,

 

I’m setting the socket timeout on my requests as follows:
requestBuilder.setConfig(RequestConfig.copy(this.objHttp.getRequestConfig())
.setSocketTimeout(responseTimeoutToSet).build());

 

I have double checked that the variable ‘responseTimeoutToSet’ has the right
value. So if I set up a socket timeout of 1000ms or 2000ms or 3000ms, it
works fine. But if I set up a socket timeout of 1200ms, the exception is
thrown after 2000ms. And if I set up a socket timeout of 2400ms, the
exception is thrown after 3000ms.

 

Is this right behaviour with the async client? The blocking client respects
strictly the socket timeout, but the async seems to skip from 1 to 2 to 3
seconds …

 

Thanks,

 

Joan.


RE: Socket timeout in the async http client

Posted by Joan Balagueró <jo...@grupoventus.com>.
Hi Dmitry,

Thanks for the explanantion. It's clear now.

Joan.

-----Mensaje original-----
De: Dmitry Potapov [mailto:potapov.d@gmail.com] 
Enviado el: viernes, 7 de octubre de 2016 15:18
Para: HttpClient User Discussion
Asunto: Re: Socket timeout in the async http client

Hello Joan,

Async client works on reactor model, so timeouts being checked only between selects.
You can change interval between selects by using setSelectInterval function in IOReactorConfig builder:
For example: IOReactorConfig.custom().setSelectInterval(100L).build();

Please be concern that reducing this value causes reactor threads to consume more CPU resources.

--
Dmitry

On Fri, Oct 07, 2016 at 03:03:44PM +0200, Joan Balagueró wrote:
> Hello,
> 
>  
> 
> I’m setting the socket timeout on my requests as follows:
> requestBuilder.setConfig(RequestConfig.copy(this.objHttp.getRequestCon
> fig()) .setSocketTimeout(responseTimeoutToSet).build());
> 
>  
> 
> I have double checked that the variable ‘responseTimeoutToSet’ has the 
> right value. So if I set up a socket timeout of 1000ms or 2000ms or 
> 3000ms, it works fine. But if I set up a socket timeout of 1200ms, the 
> exception is thrown after 2000ms. And if I set up a socket timeout of 
> 2400ms, the exception is thrown after 3000ms.
> 
>  
> 
> Is this right behaviour with the async client? The blocking client 
> respects strictly the socket timeout, but the async seems to skip from 
> 1 to 2 to 3 seconds …
> 
>  
> 
> Thanks,
> 
>  
> 
> Joan.
> 

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




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


Re: Socket timeout in the async http client

Posted by Dmitry Potapov <po...@gmail.com>.
Hello Joan,

Async client works on reactor model, so timeouts being checked only between selects.
You can change interval between selects by using setSelectInterval function in IOReactorConfig builder:
For example: IOReactorConfig.custom().setSelectInterval(100L).build();

Please be concern that reducing this value causes reactor threads to consume more CPU resources.

-- 
Dmitry

On Fri, Oct 07, 2016 at 03:03:44PM +0200, Joan Balaguer� wrote:
> Hello,
> 
>  
> 
> I�m setting the socket timeout on my requests as follows:
> requestBuilder.setConfig(RequestConfig.copy(this.objHttp.getRequestConfig())
> .setSocketTimeout(responseTimeoutToSet).build());
> 
>  
> 
> I have double checked that the variable �responseTimeoutToSet� has the right
> value. So if I set up a socket timeout of 1000ms or 2000ms or 3000ms, it
> works fine. But if I set up a socket timeout of 1200ms, the exception is
> thrown after 2000ms. And if I set up a socket timeout of 2400ms, the
> exception is thrown after 3000ms.
> 
>  
> 
> Is this right behaviour with the async client? The blocking client respects
> strictly the socket timeout, but the async seems to skip from 1 to 2 to 3
> seconds �
> 
>  
> 
> Thanks,
> 
>  
> 
> Joan.
> 

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