Hi, You should make sure to reuse your HttpClient instance.
Gary On Fri, Feb 22, 2019, 05:08 Santhosh Kumar <santtar...@gmail.com wrote: > Hi - In our project we are using Apache http client and fluent jar to the > hit AWS cloud endpoint where in we pass request and get the response back. > Code snippet is given below. But the performance is very slow. Connection > establishing and socket read takes more time. Can you please suggest if > there is any way to optimize this? > > Executor executor = Executor.newInstance(httpClient); > //Executor executor = Executor.newInstance(buildHttpClient()); > Response channelResponse = null; > Request httpRequest = Request.Post(serviceEndpointUrl) > .addHeader("Service", wizConnectRequest.getTransCode()) > .addHeader("consumer", channel).addHeader("Async", > String.valueOf(wizConnectRequest.isAsync())) > .addHeader("TimeOutPeriod", > Integer.toString(wizConnectRequest.getTimeOutPeriod())); > > > channelResponse = executor.execute(httpRequest.useExpectContinue() > .connectTimeout(endPointTimeout) //in milliseconds TODO is it not managed > through the Spring??? > .bodyString(request, ContentType.DEFAULT_TEXT)); > > I have attached the performance snapshot using Dynatrace tool where the > total time taken is 589.62. Please let me know. > > Regards > Shan > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org > For additional commands, e-mail: httpclient-users-h...@hc.apache.org