Hi Alex,

So just to clarify, you are saying that if the webservice supports
Persistent connection, then only I will get the performance benefit that I
want?

Am I correct?

Regards,
Sreyan

On Sat, Jun 16, 2018 at 11:24 PM Alexey Panchenko <alex.panche...@gmail.com>
wrote:

> Hi Sreyan,
>
> It's a little bit not clear what is compared, as you provided only one code
> snippet.
> PoolingHttpClientConnectionManager is used even if you create HttpClient
> with HttpClients.createDefault(), just parameters are different.
>
> A performance benefit can happen if the services called support persistent
> connections <https://en.wikipedia.org/wiki/HTTP_persistent_connection>.
> In order to understand what happens you can enable debug logging for
> HttpClient.
>
> Regards,
> Alex
>
> On Sun, Jun 17, 2018 at 12:33 AM Sreyan Chakravarty <
> sreyan.mail...@gmail.com> wrote:
>
> > 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
> >
>

Reply via email to