Consistent hashing maps requests to servers while minimizing redistribution when servers change.
Use cases:
- Session affinity (same user → same server)
- Distributed caching (same key → same cache node)
- Database sharding
How it works:
Hash both keys and servers onto a ring. Each key maps to nearest server clockwise.
When server added/removed:
Only keys between old and new position move. Others stay put. ~/N keys affected vs ~% with modulo hashing.