spring-bootconnection-poolingfeignapache-httpclient-5.x

Is it safe to use a single Apache HttpClient 5 (with PoolingHttpClientConnectionManager) for accessing both fast and slow endpoints?


I'm using Apache HttpClient (version 5.4.x) with PoolingHttpClientConnectionManager, which pools connections on a per-route basis. According to the documentation, each route has its own pool of connections.

However, I’m concerned that a surge of slow, long-running requests could tie up enough connections to delay or block the faster requests.

My question is: Does the per-route connection pooling fully isolate these two types of requests, or is there a risk of one affecting the other under heavy load?


Solution

  • HttpClient manages persistent connections in the pool based on their routes, not their performance characteristics. If a particular route has a higher priority than others one may allow that route to allocate more concurrent connections but this has nothing to do with performance of individual message exchanges. Connections for that specific route will always be allocated regardless of other routes as long as the total max number of connections has been reached