Load balancing algorithms in F5 XC: round robin vs least active request vs ring hash
Selecting the right load balancing algorithm is a foundational decision in F5 Distributed Cloud (XC). The algorithm decides which origin server in an origin pool receives each request, which directly affects performance, resource use and user experience. XC origin pools offer Round Robin (the default), Least Active Request, Random and Ring Hash. Understanding how each behaves helps you match the choice to your workload.
Round Robin: Simplicity and Predictability
Round robin distributes requests sequentially across all healthy origins in a pool. Each origin receives traffic in turn, cycling back to the first after the last is served. This algorithm requires minimal state tracking and performs well when origins have similar capacity and request processing times are uniform.
Round robin is ideal for homogeneous backend environments: identical virtual machines, containers, or instances running the same application code. It is also the default choice when you lack visibility into backend response times or connection counts. The predictability makes troubleshooting straightforward, and the low computational overhead scales efficiently in high-throughput scenarios.
However, round robin ignores actual backend load. If one origin is slower or handling longer requests, round robin continues sending it equal traffic, causing queuing and latency. It also does not preserve session affinity by default, which can break stateful applications unless sticky sessions are explicitly configured.
Least Active Request: load-aware distribution
Least Active Request is XC's load-aware option, the HTTP-proxy equivalent of least connections. Each new request goes to the origin with the fewest requests currently in flight, so the distribution adapts in real time to how busy each origin actually is. That makes it a better fit than round robin when request processing times vary or origins have different capacities.
It works well for APIs with a mix of fast and slow calls, long-running requests such as large downloads or report generation, and pools that mix larger and smaller instances. If one origin becomes slow, its in-flight count rises and new requests shift to its peers, which reduces tail latency.
The trade-off is that the choice is only as good as the signal. In-flight request counts are tracked by each load balancer instance separately, so with traffic spread over many regional edges each one has a partial view. And with very short, uniform requests, counts stay near zero everywhere and the result looks much like round robin.
Hash-Based Algorithms: Session Affinity and Consistency
Ring Hash maps each request to an origin by hashing a request attribute, so the same client keeps reaching the same origin. In XC you select Ring Hash as the origin pool's algorithm and define what is hashed in the HTTP load balancer's hash policy: for example the source IP, a cookie or a request header. Cookie-based and source-IP stickiness are also available on the HTTP load balancer.
Hash algorithms are essential for stateful applications: shopping carts, user sessions, in-memory caches, or any workload where backend state is not shared across origins. They also provide cache locality benefits. Requests from the same client repeatedly hit the same origin, improving cache hit rates and reducing backend database load.
Consistent hashing variants (such as ring-based hashing) mitigate the problem of uneven distribution when origins are added or removed from the pool. Without consistent hashing, adding a single origin causes most requests to rehash to different backends, invalidating caches and breaking sessions. Consistent hashing minimizes this disruption.
The downside: hash-based algorithms do not adapt to backend load. A slow origin continues receiving traffic from its mapped clients. If a single client generates high load, it can overload its assigned origin while others remain underutilized. Hash is also unsuitable for stateless, short-lived request patterns where affinity provides no benefit.
Choosing the Right Algorithm for Your Workload
- →Use round robin for stateless, homogeneous backends with uniform request processing times and high throughput requirements.
- →Use Least Active Request for heterogeneous backends, long-lived connections, or workloads where backend load varies significantly.
- →Use Ring Hash for stateful applications, session persistence, cache locality, or when affinity is a functional requirement.
- →Monitor active connection counts, response times, and origin utilization after deployment to validate your choice.
- →Whatever you choose, configure origin pool health checks. An origin that fails them is taken out of rotation for every algorithm, which matters more than the algorithm itself during an outage.
In F5 XC the algorithm is set per origin pool (Load Balancer Algorithm), while the hash inputs for Ring Hash and any session stickiness are set on the HTTP load balancer that uses the pool. Choose based on how your application actually behaves, then measure origin response times and utilisation after the change and adjust if needed.