HAProxy is a high-performance, open-source load balancer trusted by some of the highest-traffic websites in the world. Deploying it on Ubuntu provides a reliable foundation for distributing traffic across your backend servers.
Configuration and Health Checks
HAProxy's configuration divides into frontend listeners and backend server pools. Frontends define how incoming connections are accepted, while backends specify which servers handle the traffic and how health checks verify their availability.
Active health checks with configurable intervals and thresholds ensure traffic is only routed to healthy backends. HTTP health checks that verify application-level responses are more reliable than simple TCP port checks for detecting partial failures.
For true high availability, deploy HAProxy in a pair with Keepalived managing a floating virtual IP address. If the primary HAProxy instance fails, Keepalived automatically promotes the standby instance within seconds, maintaining uninterrupted service.