Is it possible to synchronize the states of TCP proxies in real time (for real-high-availability of SLB)?

Consider that there are two server Load Balancers working in TCP proxy mode (e.g., for L7 Load Balancing). Is it possible to synchronize their states in real time so that they can be a backup for each other?

In case that one is down, the other still has all necessary states to uninterruptedly support all existing TCP connections.

I understand that this is hard, but I am wondering whether any free/commercial LB already supports this feature.

Thank you!


Solution 1:

You can use the stick-table replication that we added to HAproxy for use in the Loadbalacer.org appliance.

Here is an example config: (the important bit is the peers section)

# HAProxy configuration file generated by loadbalancer.org appliance
global
    daemon
    stats socket /var/run/haproxy.stat mode 600 level admin
    pidfile /var/run/haproxy.pid
    log /dev/log local4
    maxconn 40000
    ulimit-n 81000
    tune.bufsize 16384
    tune.maxrewrite 1024

defaults
    mode http
    balance roundrobin
    timeout connect 4000
    timeout client 42000
    timeout server 43000
    log global

peers loadbalancer_replication
    peer lbmaster 192.168.67.28:7778
    peer lbslave 192.168.67.29:7778
    listen VIP_Name
    bind 192.168.67.30:80

You will also need to change the way that you start HAProxy: Check out the detailed documentation on peers: http://haproxy.1wt.eu/download/1.5/doc/configuration.txt

Bear in mind that failover still won't be totally seamless, but your stick tables will hold the correct destination server when you have a fail over.

Solution 2:

You can use the Linux Virtual Server (LVS) framework that is present in the Linux kernel. http://www.linuxvirtualserver.org/index.html

It supports TCP connection synchronization for transparent load balancer failover. http://www.linuxvirtualserver.org/docs/sync.html

You can use KeepAliveD to configure both the load balancer (LVS) behavior and the failover (VRRP) behavior with connection synchronization. https://www.keepalived.org/