HAProxy ALOHA Documentation 11.5


HAProxy ALOHA can operate as a TCP proxy, in which TCP streams are relayed through the load balancer to a pool of backend servers. The TCP stream may carry any higher-level protocol (e.g. HTTP, SMTP, Redis, MySQL). Because it does not read application-level metadata such as HTTP headers, proxying involves less overhead and can be faster.

  1. The client connects to your application at the configured public IP address. The HAProxy ALOHA listens at that address and receives the packets.

  2. HAProxy ALOHA makes a separate connection to one of the backend servers and relays the packets over that connection. In other words, the client's original connection is not routed to a backend server directly. Instead, the client communicates with the HAProxy ALOHA only.

  3. The backend server sends its response back to HAProxy ALOHA and then HAProxy ALOHA relays it back to the client over the frontend connection.

Set TCP mode

  1. In the web UI's LB Layer 7 tab, set the mode directive to tcp in both the frontend and backend sections of your configuration to load balance TCP connections. Note that if you do not specify the mode, it defaults to tcp.

    In the following example, we load balance MySQL servers. Typically, it is best to set the load balancing algorithm to least connections when the servers may hold the connection for a variable amount of time. That algorithm sends the next client to the server with the fewest active connections.

    Set the mode to tcp to load balance TCP traffic.

    frontend mysql
       mode tcp
       bind :3306
       default_backend mysql_servers
    backend mysql_servers
       mode tcp
       balance leastconn
       server s1
       server s2

Next up