Resilient ECMP Next-Hop Groups With Minimal Flow Disruption
Last updated: November 29, 2026
Quick Overview
Design an ECMP group that maps flows to next hops through a fixed bucket table so that removing a failed next hop only moves flows that were on it, and adding a next hop moves only the flows it takes over.
Arista Networks
November 29, 20260
0
0 solved
Design an ECMP group that maps flows to next hops through a fixed bucket table so that removing a failed next hop only moves flows that were on it, and adding a next hop moves only the flows it takes over.
Arista switches in cloud and AI fabrics spread flows across many equal-cost uplinks, and plain hash-mod-N reshuffles almost every flow when one link fails, breaking stateful load balancers and TCP flows. The interviewer looks for the resilient hashing idea and balance after changes.
What the Interviewer Expects
- Explain why `hash % N` moves about (N-1)/N of flows on a membership change
- Use a fixed number of buckets, each pointing at a next hop
- On removal, reassign only the failed member's buckets to the least loaded survivors
- On addition, take buckets only from members above their fair share
- Verify that only affected flows moved
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you pick the bucket count, and what imbalance does it leave?
- How does this map onto ASIC ECMP tables with limited entries?
- Compare with consistent hashing on a ring or rendezvous hashing.
- How do you handle weighted next hops (UCMP)?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Group holds next hops; pick(flow) returns the next hop for a 5-tuple. remove(nh) and add(nh) change membership. Goals: flows not on a changed member never move, and bucket counts stay within one...
High-Level Design
Hash the flow into one of B fixed buckets (B much larger than members, say 64 to 256). The flow-to-bucket map never changes; only the bucket-to-next-hop map does. Removal rewrites just the failed memb...