HAProxy is a high-performance TCP and HTTP proxy that distributes traffic across multiple backend servers to ensure availability and fault tolerance for critical services. It operates in either TCP or HTTP mode, with an event-driven, single-threaded reactor that handles tens of thousands of connections without context switching, and supports kernel-level data transfer to minimize memory usage and latency.
What distinguishes HAProxy is its configuration-file-first design, where all load-balancing rules and runtime behavior are defined in a declarative text file parsed at startup. It embeds a Lua interpreter for custom request handling and routing logic, and exposes a runtime socket control plane that accepts text commands to modify server states, weights, ACLs, and maps without restarting the process. A shared-memory stick-table engine maintains session state and counters that can be synchronized across peer instances, while the ACL-based decision tree evaluates named conditions to branch traffic through a rule chain of actions.
The platform provides comprehensive traffic management capabilities including load balancing with configurable algorithms, HTTP header and content rewriting, session persistence, rate limiting, and bandwidth controls. It handles SSL/TLS termination with automatic certificate management via the ACME protocol, and supports Kubernetes ingress and gateway traffic control using standard Gateway API and Ingress API rules. Observability features include customizable log formats, remote log forwarding, request tracing, and real-time system metrics monitoring.
HAProxy offers multiple interfaces for runtime configuration management, including a REST API for programmatic load balancer configuration, interactive CLI sessions over Unix sockets, and in-memory map editing without configuration reloads.