3 Quorum
You replicate data to 3 nodes for fault tolerance. A client writes a new value to Node A, but the write hasn't propagated to Nodes B and C yet. Another client reads from Node B and gets stale data. How do you guarantee that reads always see the latest write, without waiting for every replica to acknowledge?
Background
Replication creates copies of data for durability and availability. But it also creates a consistency problem: at any moment, different replicas may have different versions of the data. The question is: how many replicas need to participate in an operation before you can trust the result?
Definition
A quorum is the minimum number of nodes that must successfully complete a distributed operation (read or write) before the operation is considered successful. By requiring enough nodes to participate, you guarantee overlap between the nodes that stored a write and the nodes that serve a read.
The quorum formula
The magic formula is: R + W > N
| Variable | Meaning |
|---|---|
| N | Total number of replicas |
| W | Minimum nodes that must acknowledge a write |
| R | Minimum nodes that must respond to a read |
When R + W > N, there's guaranteed overlap -- at least one node in every read quorum has seen the latest write. This gives you strong consistency.
Common configurations
| Configuration | Behavior | Trade-off |
|---|---|---|
| N=3, W=2, R=2 | Strong consistency, balanced read/write performance | Most common default |
| N=3, W=3, R=1 | Writes are slow (must hit all nodes), reads are fast | Good for read-heavy workloads |
| N=3, W=1, R=3 | Writes are fast, reads are slow | Good for write-heavy workloads (but fragile -- one node failure blocks reads) |
| N=3, W=1, R=1 | Fast everything, but no consistency guarantee | Eventually consistent -- used when speed matters more than correctness |
Think of it like a Venn diagram. W is the set of nodes you wrote to. R is the set of nodes you read from. If R + W > N, these two sets must overlap. The overlapping node guarantees your read sees the latest write.
Strict quorum vs. sloppy quorum
Strict quorum
Reads and writes must go to the designated replica nodes for each key. If not enough designated replicas are available, the operation fails. This gives strong consistency but reduces availability during failures.
Sloppy quorum
If designated replicas are down, the system can write to any available node (not just the key's replicas). This keeps writes succeeding even during failures but sacrifices consistency -- the write might end up on a node that doesn't normally hold that key. The data is forwarded to the correct node later via hinted handoff.
Always clarify: "Are we talking about strict quorum or sloppy quorum?" Strict quorum gives you the R + W > N consistency guarantee. Sloppy quorum keeps the system available during failures but breaks that guarantee. Dynamo famously uses sloppy quorum -- it prefers to always accept writes, even at the cost of temporary inconsistency.
Examples
Cassandra
Cassandra makes quorum a first-class API concept. Every read and write specifies a consistency level:
ONE-- only one replica must respond (fast, eventually consistent)QUORUM-- majority must respond (strong consistency with R + W > N)ALL-- every replica must respond (strongest consistency, lowest availability)
This per-query tuning is one of Cassandra's most powerful features.
Dynamo
Dynamo uses a sloppy quorum. Writes go to the first W healthy nodes from the preference list (which may include nodes not normally responsible for that key). This means Dynamo always accepts writes, even during failures -- but the R + W > N guarantee doesn't strictly hold.
Chubby
Chubby uses Paxos, which requires a majority quorum for all writes. In a typical 5-node Chubby cell, writes need acknowledgment from at least 3 nodes. This gives Chubby its strong consistency guarantee.