Currently, I have a single client (component) having a single persistent TCP connection with the server(another component), and messages are exchanged asynchronously. I wanted to have a load balancer (HAProxy preferably) where the connection b/w client and load balancer as well as b/w load balancer and multiple servers as persistent TCP connection.
I know HAProxy can easily be set up for the TCP load balancing, but I wanted to know does it support persistent connections out of the box. Would be great help if someone points me in the right direction. Thanks.
Yes it supports persistent TCP connections right out of the box. A simple implementation in the haproxy looks like this
listen tcpProxy 0.0.0.0:7000
mode tcp
balance source
server tcp1 ip1:port check maxconn 10000
server tcp2 ip2:port check maxconn 10000
Hope this helps
This is impossible. TCP is a stateful protocol. Even we do it by some tricks, such as an iptables mirror, the target backend host will drop packets which it has no handshake or pre packets.
You would have to consider UDP instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With