Persistent connections (1.4)


#1

Howdy folks!

I’m new with HAProxy and using HAProxy mostly for TCP connection (non-HTTP). The main use is as a proxy in the middle between our application and our backend services.

One of the issues I’m trying to find how to fix is to prevent HAProxy in opening a new connection each time it talks to a backend server. As mentioned in the subject, the version I’m running is 1.4 (1.4.24) which might be a bit old :).

Is there a way to make HAProxy have some type of connection pooling? The closest I can describe is mcrouter where it opens connections to the memcache hosts and keeps the connections open all the time so it avoids all the TCP hand-shake all the time.

fwiw I already tried the tcpka options but that only sets the TCP flag (confirmed by ss -e) but HAProxy is still closing and opening new connections.

Thanks!


#2

You have to upgrade to haproxy 1.6 and use the http-reuse feature.

1.5 supports keep-alive mode, but only for one specific sessions.

1.4 only supports http-tunneling (switching to TCP mode after the first HTTP transaction).