Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference beetween max connections per route and max connections total in apache HttpClient?

Tags:

java

apache

feign

I'm trying to understand what is the difference between them. I tried to read the documentation but it does not help alot.

HttpClientBuilder
                    .create()
                    .setMaxConnPerRoute(maxConnectionsPerRoute)
                    .setMaxConnTotal(maxConnectionTotal)
                    .build();

It's the same of setDefaultMaxPerRoute and setMaxTotal from PoolingHttpClientConnectionManager:

final PoolingHttpClientConnectionManager poolingmgr = new PoolingHttpClientConnectionManager();
poolingmgr.setDefaultMaxPerRoute(max);
poolingmgr.setMaxTotal(2 * max);
like image 287
Rafael Ferreira Rocha Avatar asked Jul 08 '19 20:07

Rafael Ferreira Rocha


1 Answers

setMaxConnTotal is the total maximum connections available in the connection pool. setMaxConnPerRoute is the total number of connections limit to a single port or url.

Hope it is clear now

like image 118
khush Avatar answered Sep 26 '22 07:09

khush