What about custom connection factory and custom connection reuse strategy? First one will create TimeAwareHttpClientConnection, the second one will kill connections which is older than 1 minute (or what refresh interval you want). Moreover, you could notify your custom connection reuse strategy about dns changes, so connections refresh could be achieved faster.
-- Dmitry Potapov On Fri, Jul 03, 2015 at 04:38:19PM +0300, Серега Красильников wrote: > > I'm sorry, that was missclick! > > <<< > Good day ladies and gentlemen! > > Short intro: > We have an APIs on AWS EC2. We have AWS load balancer (LB) and a lot of > instances behind. Once a time, depends on load, LB is adding new instance > with new DNS. > > What we want to have: > Once in a short period of time kill connection to have a reference on a new > Amazon instance. > > What approaches we've found: > 1. Make HttpClient use NoConnectionReuseStrategy - this might cost a lot for > big amount of requests > 2. Make HttpConnectionMetrics of each connection hold time of creation (and > then calculate kill it or no) > 3. Make custom PoolingHttpClientConnectionManager, which would use our custom > HttpClientConnection wrapper to have there creation time. > > Main question we have is - how rchitecturally correct do it. > >>> > > Thanks, Sergey K. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
