hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Check Peck <comptechge...@gmail.com>
Subject Re: What is the relation between TIME_WAIT and HTTP Client calls to a RestService?
Date Fri, 26 Jun 2015 21:47:39 GMT
Thanks Oleg. Also I was not able to understand what does
setExpectContinueEnabled mean? Should this be enabled or disabled for
performance improvements?

On Fri, Jun 26, 2015 at 1:22 AM, Oleg Kalnichevski <olegk@apache.org> wrote:

> On Thu, 2015-06-25 at 12:33 -0700, Check Peck wrote:
> > Thanks Oleg. Got the idea now. Basically earlier, I was not using setting
> > any timeout value on Http request but I was setting the timeout value on
> my
> > Future and by default the timeout value on http request was -1 so it was
> > waiting for most of the time and that's why I was seeing lot of
> TIME_WAIT.
> > I have made the code changes like this now:
> >
> > This is the request factory I am setting on my RestTemplate now. I wanted
> > to check with you to see, do you think these settings are ok for better
> > performance?
> >
> >         private ClientHttpRequestFactory clientHttpRequestFactory() {
> >             HttpComponentsClientHttpRequestFactory requestFactory = new
> > HttpComponentsClientHttpRequestFactory();
> >             RequestConfig requestConfig =
> >
> RequestConfig.custom().setConnectionRequestTimeout(1000).setConnectTimeout(1000)
> >
> > .setSocketTimeout(1000).setStaleConnectionCheckEnabled(false).build();
> >             SocketConfig socketConfig =
> > SocketConfig.custom().setSoKeepAlive(true).setTcpNoDelay(true).build();
> >
> >             PoolingHttpClientConnectionManager
> > poolingHttpClientConnectionManager = new
> > PoolingHttpClientConnectionManager();
> >             poolingHttpClientConnectionManager.setMaxTotal(800);
> >
>  poolingHttpClientConnectionManager.setDefaultMaxPerRoute(700);
> >
> >             CloseableHttpClient httpClientBuilder =
> > HttpClientBuilder.create()
> >
> >
> .setConnectionManager(poolingHttpClientConnectionManager).setDefaultRequestConfig(requestConfig)
> >                     .setDefaultSocketConfig(socketConfig).build();
> >
> >             requestFactory.setHttpClient(httpClientBuilder);
> >             return requestFactory;
> >         }
> >
>
> Settings look reasonable to me.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message