Load balance UDP
UDP load balancing on the LB Layer7 tab
This page applies to:
- HAProxy ALOHA 17.0 and newer
You can load balance UDP (User Datagram Protocol) by using HAProxy ALOHA’s UDP module.
What is UDP? Jump to heading
Applications employ UDP when they need a fire-and-forget transport of messages over a network, with minimal overhead. Because UDP lacks the message delivery guarantees that TCP has, it can be ideal for some situations but not others. For example, when sending syslog messages over a network, you might prefer TCP if you require delivery of all messages. Or you might choose UDP if it’s acceptable to lose some messages, but allow the sender to continue sending messages without waiting for confirmation they’ve been received. Under some network conditions, such as where there’s significant packet loss, UDP can have better throughput. But it can perform worse in congested networks, since it lacks TCP’s congestion control.
How does the UDP module work? Jump to heading
The UDP module adds support for a new section in your LB Layer7 configuration called udp-lb. The udp-lb section defines the IP address and UDP port at which to accept datagrams. Also in this section, you’ll define the backend servers to load balance datagrams across. The module supports health checking servers and logging traffic too.
Multiple ways to support UDP
HAProxy ALOHA also supports UDP load balancing on its LB Layer4 tab, which uses LVS. You might prefer LVS if you require the utmost speed, since it routes UDP packets without any overhead. You might prefer this LB Layer7 UDP module for better session tracking, logging, and statistics.