Consistency, Quorums & CAP
Replication forces copies to disagree. The consistency ladder, the N/W/R quorum rule (W+R>N), and CAP stated precisely — the real choice is C-vs-A only during a partition — turned live on a 5-replica cluster.
Concept · Systems. The source ↗
A free, interactive, animated visual explainer of Consistency, Quorums & CAP — built to be understood, not skimmed.
Questions
- What does W + R > N actually guarantee?
- That the set of replicas a write lands on and the set a read consults must overlap in at least one node — so a read is guaranteed to touch a replica that already has the latest acknowledged write and can return it. N is the replica count, W the number of replicas that must ack a write, R the number that must answer a read. If W + R ≤ N the two sets can be disjoint and a read can miss the newest write. The Dynamo paper states it directly: "Setting R and W such that R + W > N yields a quorum-like system."
- Is partition tolerance optional in the CAP theorem?
- No. A network partition is a fact you cannot design away — packets get dropped or delayed — so a real distributed system must tolerate P. That means the actual choice CAP forces is between consistency and availability, and only during a partition. Eric Brewer: "The '2 of 3' formulation was always misleading… CAP prohibits only a tiny part of the design space: perfect availability and consistency in the presence of partitions, which are rare."
- What is the difference between CAP and PACELC?
- CAP only describes the partition case. PACELC adds the far more common no-partition case: even when the network is healthy, a replicated system trades consistency against latency. Daniel Abadi: "if there is a partition (P), how does the system trade off availability and consistency (A and C); else (E), when the system is running normally in the absence of partitions, how does the system trade off latency (L) and consistency (C)?"
- What is a sloppy quorum?
- A relaxation of the strict W-of-N rule so a system stays writable during failures. Instead of requiring the specific replicas that own a key, a sloppy quorum accepts the write on the first N healthy nodes it can reach and hands it off later. Dynamo: "it does not enforce strict quorum membership and instead it uses a 'sloppy quorum'; all read and write operations are performed on the first N healthy nodes from the preference list." It buys availability at the cost of the strict overlap guarantee — the write may not land where a later read looks.
- Which consistency model does etcd, ZooKeeper, or Cassandra use?
- etcd and ZooKeeper are CP systems built on a majority-quorum consensus log: etcd "ensures linearizability for all other operations by default"; ZooKeeper gives sequential consistency for writes but reads can be stale unless you call sync(). Cassandra is tunable — it "supports a per-operation tradeoff between consistency and availability through Consistency Levels," so reading and writing at QUORUM gives W+R>RF and strong reads, while ONE gives eventual consistency and lower latency.
Related explainers
- Design a Stream Processor with Exactly-Once
- Design a Distributed Cache
- Back-of-the-Envelope: the Numbers That Design Systems
- Threads, Locks & the Anatomy of a Race
- How to Design a System in 60 Minutes
- Rate Limiting: Four Algorithms, Honestly Compared
- Idempotency & the Exactly-Once Illusion
- Design Ad-Click Aggregation (Lambda vs Kappa)