ECMP Explained: How Data Centers Spread Traffic Across Every Link
ECMP turns a Clos fabric's dozens of equal-cost paths into real bandwidth — until identical hashes polarize traffic onto a few hot links. How the 5-tuple hash works, why polarization happens, and how to break it.
Start with the supermarket
It's Saturday morning and the supermarket has 8 checkout lanes open. There are two ways to get shoppers through. Option one: a single line feeds one lane, and the other seven lanes sit empty. Option two: shoppers pick lanes, and all eight ring up groceries at once.
Option one is classic routing: one best path, everything else idle. Option two is ECMP — Equal-Cost Multi-Path routing.
But there's a catch the supermarket knows well. You don't send items to different lanes — that would scramble everyone's groceries. You send whole shoppers to lanes. ECMP does the same: it never splits one flow across links (that would reorder packets and wreck TCP). It assigns each flow to one lane, and every packet of that flow follows.
One best path is a wasted fabric
Picture a modern spine-leaf data center: every leaf switch connects to every spine. Between any two racks there aren't one or two paths — there are dozens, all the same length, all the same cost. Classic routing picks exactly one best path and programs it into the forwarding table. The other thirty-one links become expensive decoration. You've built a 32-lane highway and you're driving every car down a single lane.
Equal-cost multi-path routing — ECMP — is the fix. When the routing table holds several equal-cost routes to the same destination, the router installs all of them and spreads traffic across every link. In hyperscale fabrics ECMP isn't an optimization; it is the forwarding model.
What ECMP actually does
It starts in the control plane. OSPF, IS-IS, or BGP computes routes; when several routes to a prefix tie — same OSPF cost, or BGP multipath policy — the RIB keeps all of them instead of one winner. The forwarding plane programs an ECMP group into the FIB: one destination, N next-hops, N egress interfaces.
Each arriving packet is assigned to one member of the group. The assignment happens in hardware, per packet, at line rate — and it must be consistent: every packet of a flow has to take the same path, or TCP sees reordering, assumes loss, and collapses its congestion window (TCP's way of saying "the network is struggling, I'll send slower" — a false alarm here, but a costly one). So the switch doesn't round-robin packets. It hashes flows.
The hash: five fields in, one link out
The classic ECMP hash input is the 5-tuple: source IP, destination IP, protocol, source port, destination port. The hash output picks the egress member, conceptually member = hash(fields) mod N — a hash is just a blender: same ingredients in, same smoothie out, every time.
Two properties carry the whole design. Determinism: the same 5-tuple always selects the same member, so flows never reorder. Distribution: across many flows, each member should receive roughly 1/N of them.
Burn this distinction in: ECMP balances flows, not bytes. Ten thousand small flows spread beautifully. Three elephant flows can land on the same member and saturate it while sibling links idle. "Even hash distribution" and "even link utilization" are not the same thing.
Try the hash yourself
Type any 5-tuple (or step through the presets) and watch which link the hash picks. The function below is a simplified FNV-1a — real switches use proprietary hashes, but the idea is identical: same input, same link, every time.
hash = — → link —