Sreyan Chakravarty
2018-06-16 17:32:44 UTC
Hi,
I am using Apache HTTP Client with Springs Rest Template service to have
connection pooling implemented for my REST Client. The code for connection
pooling is from the documentation and is similar to this-:
PoolingHttpClientConnectionManager cm = new
PoolingHttpClientConnectionManager();
cm.setMaxTotal(200);
cm.setDefaultMaxPerRoute(20);
HttpHost host = new HttpHost("java.com", 80);
cm.setMaxPerRoute(new HttpRoute(host), 50);
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(cm)
.build();
I got this code from :
https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html
Making REST calls with and without connection pooling gives no performance
benefits. My REST calls still need 1.3ms to complete even if I make them
one after the other.
Am I doing something wrong? Is this the correct way to implement HTTP
Connection Pooling?
*Does HTTP Connection Pooling mean that subsequent HTTP requests on the
same thread will happen faster?*
Thanks,
Sreyan
I am using Apache HTTP Client with Springs Rest Template service to have
connection pooling implemented for my REST Client. The code for connection
pooling is from the documentation and is similar to this-:
PoolingHttpClientConnectionManager cm = new
PoolingHttpClientConnectionManager();
cm.setMaxTotal(200);
cm.setDefaultMaxPerRoute(20);
HttpHost host = new HttpHost("java.com", 80);
cm.setMaxPerRoute(new HttpRoute(host), 50);
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(cm)
.build();
I got this code from :
https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html
Making REST calls with and without connection pooling gives no performance
benefits. My REST calls still need 1.3ms to complete even if I make them
one after the other.
Am I doing something wrong? Is this the correct way to implement HTTP
Connection Pooling?
*Does HTTP Connection Pooling mean that subsequent HTTP requests on the
same thread will happen faster?*
Thanks,
Sreyan