Hi Craig, This is partially handled by the "http-reuse" featureof HAProxy 1.6. A real connection pool is on its way, it's a requirement for HTTP/2. That said, no idea when we'll have it.
Baptiste On Thu, Mar 31, 2016 at 5:11 PM, Craig McLure <cr...@mclure.eu> wrote: > Hi Baptiste, > > Thanks for the answer, it does help! > > There have been discussions on the list about maintaining a connection pool > with backend servers for the purposes of keep-alive, are there any plans for > this in the near future? If not, can you recommend a way to handle such > behaviour outside of haproxy? > > Thanks. > > On 22 March 2016 at 20:44, Baptiste <bed...@gmail.com> wrote: >> >> On Tue, Mar 22, 2016 at 2:17 PM, Craig McLure <cr...@mclure.eu> wrote: >> > Hi, >> > >> > I'm hoping to experiment with enabling keep-alive on my service, but the >> > documentation isn't entirely clear for my use case, the general >> > implementation is as follows: >> > >> > 1) A HTTP request comes in >> > 2) A LUA script grabs the request body, does some analysis on it, and >> > injects a Cookie: header into the request >> > 3) The request goes to a backend, where the cookie is used to determine >> > the >> > server the request should be dispatched too. >> > >> > This behaviour seems to work fine with the http-server-close or >> > httpclose >> > options, but I'm not entirely sure what would happen in a keep-alive >> > session >> > when the backend server switches. I've set http-reuse to 'safe' but >> > when >> > the second request goes to a different backend server to the first, what >> > happens to the original socket on the first server? Will it be reused by >> > other connections or does it just get dropped in a 1:1 mapping style? >> > Given >> > that it's rare that two subsequent requests on a single connection will >> > arrive at the same server, is it even worth having keep-alive support on >> > the >> > backends? >> > >> > Hopefully you guys can help. >> > >> > Thanks! >> >> Hi Craig, >> >> We miss the backend configuration and how you perform this persistence >> to be able to deliver you the best support. >> As far as I can tell, the persistence will have precedence over >> keep-alive connections, if that helps. So Imagine a client which did a >> first request which has been routed to server 1 where the connection >> is now established, a second request comes from this same client and >> your lua script sets a cookie to point it to server 2, then HAProxy >> will close the first connection and establish a new one on the new >> server. >> >> Baptiste > >