title: Apache HttpClient loadbalancing pooled connections
body: <p>We are using persistent connections, and have tried forcing connections to get dropped after x amount of time. While I see we can in theory use ConnectionKeepAliveStrategy, form what I can tell this only applies after a response..i.e. while the connection is idle.</p>
  
  <p>The issue we are having..</p>
  
  <p>Assume 1 client, hitting 2 servers (A,B) via a loadbalancer.
  When one of the servers goes offline (B), all the new connections are established on the against the server (A).
  Now when the the other server (B) comes back online, it will remain idle as all the connections are on the other server (A).  As long the client keeps accessing a connection below the idle timeout/keepalive, this will continue, leaving the B server idle (aka with zero connections).</p>
  
  <p>What we want to do..is force the all persistent connections to periodically get closed out (within a 'randomized time window'. Ideally we do not want all connections to reset at the same time).  Any suggestions on doing this?</p>
  
  <p>We tried extending <code>HttpClientConnectionManager</code>, and tracking how long a connection had been open for, then close it out after x amount time...however this does not seem to work. I'm guessing this is because <code>HttpClientConnection</code> is not in fact the actual connection, but is rather a proxy and looks like underneath this proxy, it is actually 'using' one of the established connections, as such making its impossible to actually track the time those underlying connections have been established for.</p>
  
  <p>Thoughts?</p>
  
  <p>Right now I'm toying with idea of simply calling:
  <code>HttpRequestBase.abort()</code> on 1 connection per minute once we have executed a request on it, which I think would get us some what closer to desired behavior.</p>