What Is New in HAProxy 1.6
HAProxy 1.6 delivers a significant update focused on core protocol support, enhanced traffic management, and improved observability. It introduces native HTTP/2, a revamped stick-table system, and powerful new sample converters. This version is a major step forward for handling modern web traffic and complex routing logic.
| Category | Key Changes |
|---|---|
| New Features | Native HTTP/2 support, DNS-based service discovery, new converters, Lua integration |
| Improvements | Enhanced stick tables, new ACLs, SSL/TLS improvements, logging upgrades |
| Bug Fixes | Fixes for connection handling, memory management, and various edge cases |
How does HAProxy 1.6 handle HTTP/2?
HAProxy 1.6 introduces native HTTP/2 termination, allowing it to decode HTTP/2 traffic on the frontend and communicate with backend servers over HTTP/1.1. This means you can now accept HTTP/2 connections from modern clients without requiring backend applications to support the protocol.
In practice, you enable it by adding the alpn h2,http/1.1 parameter to a bind line. This is a huge deal for performance with browsers and mobile apps that benefit from HTTP/2's multiplexing and header compression, while your existing backend infrastructure remains unchanged.
What are the new stick table capabilities?
The stick-table system was completely overhauled to support additional data types and new data synchronization methods. You can now store types like IPv6 addresses, 64-bit integers, and strings, which opens up more sophisticated tracking and routing scenarios.
More importantly, peer synchronization was added, allowing stick-tables to be replicated across multiple HAProxy nodes. This enables stateful, sticky session persistence in a clustered environment, which is essential for high-availability setups without a single point of failure.
How did service discovery get better?
HAProxy 1.6 added native DNS-based service discovery. Instead of a static list of backend servers, you can now point a backend to a DNS name. HAProxy will periodically resolve that name and automatically update the server list with the results.
This is a game-changer for dynamic environments like Docker and Kubernetes. It means your load balancer configuration can automatically adapt as containers are scaled up, down, or moved around, eliminating the need for manual config updates or complex external tooling.
What new tools are available for traffic manipulation?
A suite of new sample fetch converters was introduced, giving you more power to manipulate data on the fly. Converters like base64, json, and crc32 allow for encoding, decoding, and checksum operations directly within the HAProxy configuration.
This matters because you can now perform complex string transformations, parse JSON data from headers or cookies, and create custom hashes for load balancing decisions without needing to write Lua code for simple tasks.
How is Lua integrated?
Lua integration was significantly enhanced, moving beyond simple ACLs to allowing Lua code to register services and tasks. This lets you write more complex logic and extensions that run within the HAProxy process.
You can use Lua to implement custom health checks, modify traffic, or even create entirely new services that interact with the core load balancing functions. It effectively turns HAProxy into a programmable platform for your specific use cases.
FAQ
Does HAProxy 1.6 support end-to-end HTTP/2?
No, it supports HTTP/2 termination on the frontend. It decodes HTTP/2 from the client and communicates with backend servers using HTTP/1.1. True end-to-end HTTP/2 was added in a later version.
Can I use the new DNS service discovery with any DNS server?
Yes, it works with standard DNS servers (like BIND) as well as dynamic ones (like Consul or SkyDNS). HAProxy performs SRV record lookups for port information or A/AAAA records for IP addresses.
What is the performance impact of peer synchronization for stick tables?
There is a network overhead as table data is replicated between peers. The impact depends on the table size and update frequency. It's designed for essential session data, not for high-frequency counters.
Do I need to rewrite my configuration to use the new converters?
No, the new converters are additive. Your existing configuration will continue to work. You use the new converters by adding them to existing sample fetch expressions using the conv() method.
Is the Lua support stable for production use?
Yes, the Lua integration was considered stable in 1.6. It provides a powerful and safe sandbox for extending functionality, though the complexity of your Lua code should be weighed against the performance requirements of your environment.