How Load Balancers Distribute UDP Traffic

This article provides an overview of how Layer 4 load balancers manage and distribute User Datagram Protocol (UDP) traffic across backend server pools. Unlike TCP, UDP is connectionless, presenting unique challenges for traffic distribution, session persistence, and health monitoring. Below, we explore the mechanisms, algorithms, routing methods, and session-tracking techniques load balancers use to route UDP datagrams efficiently for applications like DNS, VoIP, video streaming, and online gaming.


The Challenge of UDP Load Balancing

TCP relies on a three-way handshake to establish a continuous session, making it straightforward for a load balancer to track active connections. In contrast, UDP sends discrete datagrams without establishing a handshake or maintaining a state.

Because the protocol lacks native connection states, UDP load balancers create “pseudo-connections” or rely on packet-level attributes to decide where each datagram should be routed.


Key Mechanisms for UDP Distribution

1. Tuple Hashing

The primary method for distributing UDP traffic is calculating a hash value from packet header fields:

The hash value maps directly to a specific backend server. This ensures that packets originating from the same client endpoint consistently reach the same backend server.

2. Connection Tracking and Session Tables

For protocols requiring multi-packet exchanges (such as streaming or gaming), the load balancer maintains a state table in memory:


Common Distribution Algorithms


Packet Forwarding Methods

Load balancers forward UDP packets using one of several network architectures:

  1. Network Address Translation (NAT): The load balancer modifies the destination IP of the incoming packet to match the chosen backend server. The return traffic must pass back through the load balancer to translate the source IP back to the virtual IP (VIP).
  2. Direct Server Return (DSR): The load balancer forwards the packet to the backend server without altering the source or destination IP (often using MAC-layer rewriting). The backend server processes the request and responds directly to the client, bypassing the load balancer on the return path. This reduces bandwidth bottlenecks on the load balancer.
  3. IP Tunneling (GRE / IP-in-IP): The load balancer encapsulates the original UDP packet in a new IP header and sends it to the backend server across Layer 3 boundaries.

Health Checking for UDP Backends

Because UDP does not acknowledge receipt of packets, load balancers verify backend availability through indirect methods: