HAProxy stands for High Availability Proxy, and is a great TCP/HTTP load balancer.
It distributes a workload across a set of servers to maximize performance and optimize resource usage.
A front-end application that relies on a database backend can easily over-saturate it with too many concurrent running connections.
HAProxy provides queuing and throttling of connections towards one or more MySQL Servers and prevents a single server to become overloaded with too many requests.
All clients connect to the HAProxy instance, and the proxy forwards the connection to one of the available MySQL Servers based on the load-balancing scheme used.
HAProxy allows for different load-balancing schemes, e.g. roundrobin or leastconn.
In the Severalnines HAProxy deploy scripts, we use the leastconn scheme so that the database server with the lowest number of connections receives the connection. If the database servers have the same number of connections, then roundrobin is performed to ensure that all servers are used.
Please sign in to leave a comment.