Distributed Systems
Consistent hashing, service discovery, partitions and CAP without slogans.
Place nodes and keys on the same hash ring and assign each key to the first node clockwise; adding or removing a node then moves only about K/N keys instead of almost all of them, virtual nodes even out the load, and the lookup is a binary search on a sorted array — this is the DSA hash table becoming a production partitioning scheme.
When instances are created and destroyed by autoscalers, schedulers and rolling deploys, a caller cannot be configured with addresses; it asks a registry that instances join with heartbeats and leave when they stop — and the registry’s staleness window, its own availability, and who does the lookup (client, load balancer or sidecar) are the design.
A network partition is not a choice — any timeout is one — so the real decision is what a system does while it lasts: refuse writes to stay consistent, or accept writes on both sides and reconcile later; quorums (W + R > N) define the boundary precisely, and PACELC adds the everyday trade the slogan omits: latency versus consistency when nothing is broken at all.