Consistent Hashing Explained
How consistent hashing works, why it beats modulo hashing when servers change, how virtual nodes balance load, and where it’s used in caches and databases.
The CAP theorem and its extension PACELC explained: consistency, availability and partition tolerance, what the trade-offs mean in practice and common myths.

The CAP theorem is one of the most quoted and most misunderstood ideas in distributed systems. Used properly, it’s a simple tool for reasoning about what happens when things go wrong.
Network partitions are not optional in distributed systems: networks fail. So the real statement is: when a partition happens, you must choose between consistency and availability.
“CA” systems only exist when there is no network to partition, like a single-node database.
Partitions are rare. Daniel Abadi’s PACELC extends CAP to normal operation:
If there is a Partition, choose A or C; Else, choose Latency or Consistency.
Keeping replicas perfectly consistent means waiting for them to agree, which adds latency. Serving from the nearest replica is faster but may return slightly stale data.
| Style | During a partition | Normally | Typical use |
|---|---|---|---|
| PC/EC | Consistency | Consistency | Banking ledgers, inventory counts |
| PA/EL | Availability | Latency | Social feeds, shopping carts, caches |
| PA/EC or PC/EL | Mixed | Mixed | Tuned per workload |
Many databases let you tune consistency per request, for example by choosing how many replicas must acknowledge a read or write. Our guide to database replication explains these quorums. That means the same system can behave more like CP for payments and more like AP for a “likes” counter.
When you add replicas or shards, say which operations need strong consistency and which can tolerate staleness, and why. That shows the reasoning interviewers look for in our system design framework.
A single-node relational database isn’t distributed, so CAP doesn’t really apply. With replication, behaviour depends on how you configure failover and replica reads.
A guarantee that, if no new writes occur, all replicas will eventually return the same value.
Yes, as a way of thinking about failure. PACELC is often more useful for everyday design.
Every article is edited by a human and checked against our editorial policy. Spotted a mistake? Tell us.
How consistent hashing works, why it beats modulo hashing when servers change, how virtual nodes balance load, and where it’s used in caches and databases.
How CDNs work: edge locations, request routing, cache keys, Cache-Control headers, invalidation, origin shielding, security features and edge compute.
How distributed locks and leases work, why process pauses break naive locks, fencing tokens, Redis, ZooKeeper, etcd and database locks, and alternatives.