In my mutlithreaded application, I send some http requests, to some http servers, I would say 10 servers, 300 different requests per server, about once an hour, nothing too serious.
My question is: should I keep a single HttpClient for all outgoing connections ? Maybe one per unique target server ? or one per "iteration" (it takes about 10 minutes in the beginning of every hour) ?
I'm currently using a single PoolingHttpClientConnectionManager
, and HttpClientBuilder.setConnectionManager(connectionManager).build()
for every request.
I have a feeling of a real waste of resources, and I also see many connections in ESTABLISHED
state per server, though I'm using a pooling connection manager. (The requests for each server are sent one-by-one, and are not concurrent)