In other words, you may want to enable "option prefer-last-server". But in such case, you won't load-balance anymore (all requests should go to the same server.
Baptiste On Fri, Jul 27, 2018 at 7:09 PM, Cyril Bonté <[email protected]> wrote: > Hi Alessandro, > > > Le 27/07/2018 à 17:50, Alessandro Gherardi a écrit : > >> Hi, >> I'm running haproxy 1.8.12 on Ubuntu 14.04. For some reason, haproxy does >> not reuse connections to backend servers. For testing purposes, I'm sending >> the same HTTP request multiple times over the same TCP connection. >> >> The servers do not respond with Connection: close and do not close the >> connections. The wireshark capture shows haproxy RST-ing the connections a >> few hundred milliseconds after the servers reply. The servers send no FIN >> nor RST to haproxy. >> >> I tried various settings (http-reuse always, option http-keep-alive, both >> at global and backend level), no luck. >> >> The problem goes away if I have a single backend server, but obviously >> that's not a viable option in real life. >> >> Here's my haproxy.cfg: >> >> global >> #daemon >> maxconn 256 >> >> defaults >> mode http >> timeout connect 5000ms >> timeout client 50000ms >> timeout server 50000ms >> >> option http-keep-alive >> timeout http-keep-alive 30s >> http-reuse always >> >> frontend http-in >> bind 10.220.178.236:80 >> default_backend servers >> >> backend servers >> server server1 10.220.178.194:80 maxconn 32 >> server server2 10.220.232.132:80 maxconn 32 >> >> Any suggestions? >> > > Well, you've not configured any persistence option nor any load balancing > algorithm. So, the default is to do a roundrobin between the 2 backend > servers. If there's no traffic, it's very likely that there's no connection > to reuse when switching to the second server for the second request. > > >> Thanks in advance, >> Alessandro >> > > > -- > Cyril Bonté > >

