Algorithms

The routing algorithm decides which backend receives each request. Set it in the Routing & Health section when you create a load balancer. Backend weights apply on top of every algorithm — a backend with weight 200 receives twice the share of one with weight 100.

Available algorithms

AlgorithmHow it worksBest for
round_robin (default)Cycles through backends in orderEvenly sized backends serving uniform requests
least_requestSends each request to the backend with the fewest active requestsMixed request durations — keeps slow requests from piling onto one backend
randomPicks a backend at randomLarge backend pools where per-request state isn’t worth tracking
consistent_hashHashes the request so the same client keys map to the same backendCache-friendly workloads where repeat hits should land on the same backend

Sticky sessions

On L7 load balancers, enable Sticky sessions to pin a client to one backend across requests. Affinity is header-based: requests carrying the same value in the configured header (default X-User-ID) always route to the same backend.

Use sticky sessions when your application keeps per-user state in memory. Prefer stateless backends where possible — stickiness reduces how evenly load spreads.

Weights

Every backend has a Weight (default 100). Use uneven weights to:

  • Shift traffic gradually to a new version (e.g. 90 / 10 canary)
  • Send more traffic to larger instances in a mixed pool
  • Drain a backend before maintenance by lowering its weight