Correct way to implement HTTP Connection Pooling

I am using Apache HTTP Client for connection pooling during my REST API calls into certain web services.

Strange thing is that in spite of me using HTTP Connection Pooling there are no gain in my performance.

I am using Apache HTTP Client to connect to my web services, and the code is as follows from there documentation :

PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();

cm.setMaxTotal(200);

cm.setDefaultMaxPerRoute(20);

HttpHost localhost = new HttpHost("abc.com", 80);

cm.setMaxPerRoute(new HttpRoute("abc.com"), 50);

CloseableHttpClient httpClient = HttpClients.custom()

.setConnectionManager(cm)

.build();

I am using Spring's RestTemplate to wrap around the HttpClient implemenation of Apache using Spring's HttpComponentsClientHttpRequestFactory.

But even if I use...

Read More »

By: StackOverFlow - Saturday, 16 June

Related Posts