HAProxy Enterprise Documentation 2.2r1

Overview

After HAProxy Enterprise receives a connection or request in a frontend or listen section, it passes it to a backend for processing. A backend defines a pool of servers that can handle the request and return a response.

Below, we have a frontend and a backend. The backend lists application servers on the network:

frontend myproxy
   bind 10.0.0.5:80
   default_backend web_servers

backend web_servers
   server web1 192.168.0.10:8080
   server web2 192.168.0.11:8080
   server web3 192.168.0.12:8080

The load balancer sends connections to the servers equally so that each one receives a similar amount of traffic. By default, it uses the round-robin algorithm to decide which server should get the next connection. In that mode, servers are chosen in a rotation, starting from the top and looping around once you've reached the bottom.

However, you may set a different load-balancing algorithm to suit your needs by adding the balance directive to the section:

backend web_servers
   # Use the 'least connections' algorithm
   balance leastconn
   server web1 192.168.0.10:8080
   server web2 192.168.0.11:8080
   server web3 192.168.0.12:8080

Next up

Syntax