The User Datagram Protocol (UDP) is a major internet protocol, enabling clients and applications to exchange messages packaged as "datagrams." It's a uniquely connectionless transport layer protocol that doesn't require a dedicated connection before transmitting data. This skips the traditional handshake that occurs between devices over the network—a feature of other protocols. 

While UDP is lightweight, it doesn't provide error correction or retransmission of lost packets. Many real-time applications accept this tradeoff in exchange for better performance when responsiveness is critical. However, mechanisms such as checksums ensure data integrity, while port numbers determine specific functions at the source and destination.

What makes UDP useful?

UDP supports time-sensitive applications such as online games, IoT devices, and multimedia streams. Its quick and connectionless nature ensures fast, low-latency data transfers for applications that need near-instant responsiveness. By doing so, UDP sheds the processing overhead associated with error checking and error correction. 

UDP also plays a pivotal role in supporting Syslog messaging, Network Time Protocol (NTP) synchronization, DNS services, and Remote Authentication Dial-In User Service (RADIUS) networking. 

UDP offers the following benefits:

  • Its design supports query-response protocols.

  • Its simple design also supports bootstrapping involving the Dynamic Host Configuration Protocol (DHCP) and the Trivial File Transfer Protocol (TFTP).

  • It's stateless and therefore highly scalable.

  • There are no round-trip delays.

  • It supports multicast functionality.

How does UDP work?

We know that UDP is connectionless and emphasizes speed over absolute reliability. As part of that, UDP relies on the underlying network's stability—if the network is quick and low latency, then those UDP applications will work optimally. In any case, there's no assurance of delivery or ordering. 

haproxy-udp-load-balancing-diagram

Otherwise, UDP requests work similarly to other protocol requests. UDP packets are sent over the network (in datagram format) and relayed to backend servers at the UDP layer. When a response is needed, the server will create a new datagram to house the response data. A UDP application binds a socket to an endpoint combining an IP address and port.

Does HAProxy support UDP?

Yes! HAProxy Enterprise ships with the optional HAProxy Enterprise UDP Module. The module provides fast, reliable, and secure UDP proxying and load balancing alongside HAProxy’s existing TCP/HTTP support. HAProxy ALOHA also supports the UDP protocol.

HAProxy enables UDP load balancing in the cloud, containers, VMs, or on any Linux server. The module supports transparent mode and UDP applications using DNS, NTP, and RADIUS—while also enabling Syslog traffic load balancing over UDP. To learn more, check out our HAProxy Enterprise 2.9 announcement or our related on-demand webinar.