Skip to main content

Quorum Systems

1. Executive Summary​

A quorum system is a collection of subsets (quorums) of replicas such that any two quorums intersect—share at least one member. In replicated storage, quorum reads and quorum writes use these sets to enforce that a read contacts enough replicas to overlap a prior write, enabling consistency properties, fault tolerance, and controlled availability tradeoffs without requiring every replica to participate in every operation.

The classic N, R, W formulation (from Gifford 1979 and popularized by Dynamo, DeCandia et al. 2007) parameterizes replica count N, read quorum R, and write quorum W. When R + W > N, read and write quorums intersect; when W > N/2, write quorums intersect—supporting monotonic write visibility and, under additional assumptions, stronger read guarantees. Quorum systems underpin Cassandra, DynamoDB (conceptually), Riak, and countless custom control planes.

Quorum correctness is a safety argument about set intersection; liveness (operations complete during failures) requires enough alive replicas to form a quorum. Sloppy quorums and hinted handoff (Dynamo) trade strict intersection during failure for availability—reintroducing eventual consistency obligations. This chapter covers formal intersection properties, N/R/W tuning, sloppy vs strict quorums, relationship to CAP, failure modes, performance, and principal-level design reasoning.

2. Why This Topic Matters​

Quorum math appears in every principal-level system design interview involving replication: "How many nodes can we lose?" "Why R+W>N?" "Does QUORUM read guarantee latest value?" Wrong answers cause production incidents—stale reads after acknowledged writes, lost updates during partition, and mistaken belief that quorums imply linearizability.

Principal architects must:

  • Derive intersection — Not memorize R+W>N without explaining why (pigeonhole principle on replica sets).
  • Map quorums to consistency models — Intersection enables staleness bounds; does not alone imply linearizability without synchronization.
  • Design failure behavior — Strict quorum rejects ops; sloppy quorum accepts with repair debt.
  • Tune per workload — W=1, R=N for read-heavy; W=N, R=1 for write-once read-many—decision criteria, not universal rules.

Interview signal: explaining sloppy quorum + hinted handoff vs Raft majority shows operational depth beyond textbook formulas.

3. Problems Being Solved​

ProblemWithout quorumsWith quorum systems
Single point of failureOne primaryReplicate to N; tolerate failures
Read stale after writeAlways possible on random replicaR+W>N intersection—potential for fresh read
Unbounded write conflictsAll replicas accept independentlyW majority serializes write acceptance
Capacity during failureAll-or-nothingSubset quorums continue if |quorum| alive
Config flexibilityFixed primaryTune R, W per operation type

Quorum systems solve "which replicas must agree for an operation to count?" They do not automatically solve global ordering, linearizability, or transaction isolation without additional protocols (leader, version vectors, consensus).

4. Assumptions and System Model​

Assume partial failure, asynchronous network, and crash-stop replicas unless noted:

  • N replicas hold copies of each key (or partition); N is replication factor.
  • Quorum sizes R (read) and W (write) are positive integers with (1 \leq R, W \leq N).
  • Intersection property: Read set (Q_r) and write set (Q_w) each of size R and W; if (R + W > N), then (Q_r \cap Q_w \neq \emptyset).
  • Versioning: Replicas store version metadata (timestamp, vector clock, HLC)—intersection alone returns some overlapping replica, not necessarily latest without comparison.
  • CAP context: Under partition, strict quorums may fail to form (CP behavior); sloppy quorums may violate strict intersection (AP behavior).

Not assumed: Synchronized clocks for correctness; Byzantine quorum without BFT protocol; automatic latest-value read without version merge on contacted replicas.

5. Essential Terminology​

TermDefinition
QuorumSubset of replicas sufficient to perform an operation.
Replication factor (N)Total replicas for a partition/key.
Read quorum (R)Number of replicas contacted for a read.
Write quorum (W)Number of replicas that must ack a write.
Intersection (R+W>N)Any read and write quorums share ≥1 replica.
MajorityQuorum with size (> N/2); any two majorities intersect.
Sloppy quorumUse fallback replicas outside preference list when primary quorum unavailable (Dynamo).
Hinted handoffStore write for temporarily down replica; deliver on recovery.
Read repairFix divergent replicas during read when versions differ.
Anti-entropyBackground reconciliation (Merkle trees, scans).
Consistency level (CL)Cassandra/Dynamo terminology mapping to R, W.
PACELCLatency vs consistency when no partition—quorum tuning affects both.

Mnemonic: R + W > N = read and write "overlap somewhere"—not automatically "read is newest."

6. Core Mechanism​

Intersection proof (pigeonhole)​

Replicas indexed (1..N). Write quorum (Q_w), (|Q_w| = W). Read quorum (Q_r), (|Q_r| = R). If (R + W > N), then (|Q_r \cap Q_w| \geq R + W - N \geq 1). Therefore some replica participated in both operations—if that replica has the latest write applied and is consulted correctly, read can return fresh value.

Critical caveat: Intersecting replica may be stale if writes not fully applied, async replication within quorum, or sloppy quorum changed membership.

N, R, W tuning table​

ConfigurationIntersectionTypical useCaveat
R+W > NYesBalanced RWNeed version compare on R replicas
W > N/2Write-write intersectSerialize writesReads may still be stale if R small
W=1, R=NRead sees any writeWrite-heavy rare readWeak write durability if one node dies
W=N, R=1Fast read one nodeWrite-once configRead often stale
R=W=N/2+1 (majority)Both RW intersectCP-styleReject if majority down

Figure 1: With N=5, W=3, R=3, R+W>N guarantees at least one overlapping replica (N3). Read must use version merge to return latest among contacted nodes.

Strict vs sloppy quorum​

Figure 2: Strict quorums preserve intersection among live preference-list replicas; sloppy quorums sacrifice strict overlap for availability.

Read path with version merge​

Figure 3: Quorum read contacts R nodes; coordinator returns highest version; read repair propagates to lagging replica.

7. Step-by-Step Walkthrough​

Scenario: N=3, W=2, R=2, strict quorum, versions on each replica.

StepEventReplica statesNotes
0Initialall v=0—
1Write v=1N1=1, N2=1, N3=0W=2 ack from N1,N2
2Read QUORUMcontact N2,N3Intersection: N2 has v=1
3MergeN2=1, N3=0 → return 1Read repair N3
4N3 down——
5Write v=2N1=2, N2=2W=2 without N3
6N3 recoversN3=0 staleAnti-entropy / repair needed

Walkthrough insight: R+W>N with N=3,W=2,R=2: intersection size ≥1. Coordinator must compare versions—returning arbitrary intersecting replica without merge can still be wrong if intersecting node is lagging and a higher version exists on non-contacted node (when R too small). With R+W>N and proper merge among all R responses, latest among quorum is at least as new as any completed write quorum.

Sloppy quorum walkthrough: N3 down; write uses fallback N4 (outside normal set). Hint stored for N3. Strict intersection with pre-failure reads broken until repair—eventual consistency debt.

8. Invariants and Guarantees​

PropertyConditionType
Read-write intersectionR + W > NSafety (set overlap)
Write-write intersectionW > N/2Safety (overlapping writes)
Durability of ack'd writeW replicas persistedSafety—if those nodes survive
Latest readR+W>N + version merge + sync applyNot automatic—needs assumptions
LinearizabilityLeader or sync + fencingNot from quorum alone
Operation completion≥R, ≥W replicas aliveLiveness

Safety vs liveness: Quorum intersection is combinatorial safety. Forming quorums under f failures requires n > 2f for majority—liveness constraint.

9. Failure Scenarios​

Scenario 1: Stale quorum read after write​

Setup: W=2, R=2, N=3; write acks; third replica had old value; read hits two including stale if merge wrong.

Effect: Client sees old value post-write—violates user expectation; may violate linearizability.

Mitigation: SERIAL reads, leader reads, or accept eventual consistency explicitly.

Scenario 2: Sloppy quorum during partition​

Setup: Two partitions each accept writes with sloppy W.

Effect: Divergent versions—siblings; conflict resolution required.

Mitigation: Vector clocks, LWW with caution, application merge, or strict quorum reject.

Scenario 3: Hinted handoff loss​

Setup: Hint node crashes before delivering to preferred replica.

Effect: Write lost until anti-entropy—durability risk.

Mitigation: Hint replication, reduced W only with eyes open, monitoring hint queue depth.

Scenario 4: Asymmetric R and W mis-tuning​

Setup: W=1, R=1 for "speed."

Effect: No intersection guarantee; lost updates common.

Mitigation: R+W>N minimum for freshness arguments; document weak guarantees.

Scenario 5: GC grace period violation (Cassandra)​

Setup: Removed node before replication completes.

Effect: Permanent data loss for some keys.

Mitigation: Ops procedures, repair before decommission, appropriate replication factor.

10. Performance Characteristics​

FactorEffect
Higher WWrite latency ↑ (more acks); durability ↑
Higher RRead latency ↑; fresher reads possible
R+W>NMinimum coordination for intersection reads
Cross-datacenter WWAN RTT dominates write path
Read repairRead amplification; background write load
Hinted handoffExtra writes on recovery bursts

Qualitative rule: Quorum latency ≈ slowest of W or R replica responses in coordinator's set—often p99 tail matters. Do not quote universal ms figures; measure per datacenter topology.

PACELC: When no partition, low R and W improve latency at consistency cost—normal case tuning matters as much as partition case.

11. Scalability Limits​

  • Coordinator hotspot: Popular keys serialize through coordinator—separate from quorum math but coupled in Cassandra.
  • Replication factor ceiling: Higher N improves fault tolerance but increases W cost if W scales with N.
  • Quorum cross-region: W across regions makes writes latency-bound by WAN—often use LOCAL_QUORUM patterns.
  • BFT quorums: Need (3f+1) nodes for f Byzantine faults—different intersection arithmetic.

When quorums strain scale: Global W=ALL for every write—consider per-operation CL downgrade for analytics reads.

12. Operational Considerations​

  • repair: Run nodetool repair / anti-entropy on schedule—quorums leave debt.
  • Monitor hinted handoff queue: Backlog signals recovery pressure.
  • Decommission procedure: Wait for streaming completion; verify quorum health.
  • Consistency Level per query: Document service defaults; code review CL overrides.
  • Load test CL matrix: ONE vs QUORUM vs ALL under node loss.

13. Security Considerations​

  • Quorum bypass attack: Compromised coordinator skips R replicas—use authenticated replication protocol.
  • Replica impersonation: Attacker joins token ring—mutual TLS between nodes.
  • Read repair amplification: Attacker triggers expensive repairs—rate limit.
  • Small W exploits: W=1 allows single-node write acceptance—tamper target.

Quorum math assumes correct, authenticated replica responses.

14. Cost Considerations​

  • Infrastructure: Higher N increases storage and replication bandwidth linearly.
  • WAN quorums: Cross-region W multiplies egress charges.
  • Read repair: Hidden write load on read path—increases IOPS cost.
  • Engineering: Tuning CL per use case; incident analysis of sibling conflicts.

Savings: R=1, W=quorum for read-heavy rarely updated data—explicit weak consistency acceptance.

15. Production Implementations​

Amazon Dynamo (paper)​

Sloppy quorum, vector clocks, hinted handoff, Merkle tree anti-entropy—foundational AP quorum design (DeCandia et al., 2007).

Apache Cassandra​

Configurable CL: ONE, QUORUM, LOCAL_QUORUM, ALL, etc. LOCAL_QUORUM uses R+W per datacenter—implementation of Dynamo concepts.

Amazon DynamoDB​

Synchronous replication within region; quorum-like majority for durability—managed; product docs define consistency models (ConsistentRead).

Riak / Basho​

Quorum properties with sloppy quorum options—verify version-specific behavior.

etcd / Raft​

Majority quorum for log commit—strict; CP tendency; different from Dynamo sloppy quorum.

Distinction: Consensus majorities enforce one log order; Dynamo quorums enforce overlap without global order unless added.

16. Alternatives and Tradeoffs​

MechanismConsistencyAvailabilityNotes
Strict R+W>N quorumBounded staleness potentialReject if quorum downVersion merge required
Sloppy quorum + hintsEventualHigher during failureDynamo path
Single leader (Raft)Strong order per logUnavailable without majorityCP
Chain replicationStrong if head-tailHead failure blocksDifferent topology
No quorum (W=1,R=1)WeakHighestExplicit trade

Tradeoff axis: Strict quorums move toward CP; sloppy toward AP—align with CAP framing from prerequisite chapter.

17. Common Misconceptions​

MisconceptionReality
"R+W>N means linearizable"Intersection ≠ real-time order; need leader/sync.
"QUORUM read always latest"Need version merge; async apply; sloppy quorum breaks strictness.
"Higher N always better"More replicas = more failure modes and repair debt.
"Majority = quorum"Majority is special quorum; general quorums need pairwise intersection design.
"Hinted handoff is free"Durability and consistency debt until replay.
"W=ALL is always safest"Availability suffers; one slow node blocks writes.

18. Principal Architect Perspective​

  1. Derive on whiteboard — Show R+W>N proof in interviews; credibility signal.
  2. Per-operation CL — Same cluster, different guarantees by API path.
  3. Sloppy vs strict — Document partition behavior in ADR.
  4. Pair quorums with conflict handling — Vector clocks, CRDTs, or LWW with eyes open.
  5. Don't conflate with consensus — Quorum overlap ≠ total order.

Interview signal: Dynamo vs Raft quorum comparison without hand-waving.

19. Architecture Review Exercise​

Scenario: Cassandra cluster, RF=3, default CL ONE for reads and QUORUM for writes. Finance team wants read-after-write for account balance.

Review prompts:

  1. Does W=QUORUM, R=ONE satisfy RYW?
  2. What CL for balance read after write?
  3. Cost of SERIAL / LOCAL_SERIAL?
  4. Sticky coordinator vs CL change?
  5. Partition behavior with LOCAL_QUORUM?

Expected findings: R=ONE breaks freshness; recommend QUORUM or LOCAL_QUORUM reads; session stickiness; quantify latency impact.

20. Whiteboard Explanation​

90-second version:

"Quorum systems pick subsets of N replicas for reads and writes so sets overlap. Classic rule: R plus W greater than N guarantees read and write quorums share at least one node—that node saw some write, but you must compare versions across the R nodes and return the latest. W greater than N/2 makes write quorums overlap each other. Dynamo added sloppy quorums: if preferred nodes are down, accept writes on fallback nodes and hint to the real owner later—that trades availability for owing repair. Cassandra exposes this as consistency levels: ONE, QUORUM, ALL. Quorums don't give linearizability by themselves—you can still read stale values if you're not merging versions or you use sloppy quorums under partition. Raft uses strict majority quorum for a totally ordered log—different beast. Tune R and W per operation: reads that need freshness need higher R; write-heavy paths might use lower W only if you accept durability risk."

21. Interview Questions​

  1. State the R+W>N rule and why it holds.

    • Signals: Pigeonhole; intersection ≥ R+W-N.
  2. Does R+W>N imply linearizability?

    • Signals: No; version merge, sloppy quorum, async.
  3. W > N/2 purpose?

    • Signals: Write-write intersection; single latest write quorum overlap.
  4. Sloppy quorum vs strict?

    • Signals: Fallback replicas, hints, availability vs overlap.
  5. Hinted handoff risks?

    • Signals: Hint loss, consistency debt, recovery storms.
  6. Read repair purpose?

    • Signals: Fix lagging replica on read path.
  7. Cassandra ONE vs QUORUM?

    • Signals: R=1 vs R=majority; latency vs freshness.
  8. How many failures with N=5, majority?

    • Signals: f=2 crash failures tolerable for majority quorum.
  9. Quorum vs Raft majority?

    • Signals: Overlap vs total order log.
  10. W=1, R=N use case?

    • Signals: Rare reads, fast writes, weak durability—explicit.
  11. LOCAL_QUORUM benefit?

    • Signals: Avoid cross-DC WAN for quorum; scope per DC.
  12. Anti-entropy vs read repair?

    • Signals: Background full compare vs eager on read.
  13. Sibling values in Dynamo?

    • Signals: Concurrent writes; vector clock conflict.
  14. Design RF and CL for AP banking reads?

    • Signals: Higher R, session tokens, or don't use AP for balances.

22. Interview Follow-Ups​

  1. N=4, W=2, R=2—intersection?

    • Signals: R+W=4, not >N; no guarantee—fix to R+W>4 or adjust.
  2. Geo-replication quorum strategy?

    • Signals: LOCAL_QUORUM, per-region leaders, Causal+session.
  3. Calculate ops availability with f failures.

    • Signals: Need n > w+f-1 style reasoning for strict W.
  4. Migrate ONE to QUORUM without outage.

    • Signals: Gradual client rollout, latency testing.
  5. When choose chain replication over quorum?

    • Signals: Strong order, different failure profile, head bottleneck.

22A. Production Low-Level Design (Interview + Game Day)​

Design a leaderless quorum KV (N,R,W) with honest limits. Production LLD and Game Day Standard.

Parameters​

KnobTypicalEffect
N3Replica set size
W2Write quorum
R2Read quorum
R+W>NyesOverlap ⇒ read sees latest durable write (not full linearizability alone)

Step-by-step flow:

StepActionCaveat
1–2Write W nodesPartial write if crash mid-W
3–5Read R + reconcileNeed versions; not magically linearizable

LLD extras​

  • Sloppy quorum / hinted handoff under failure.
  • Read repair + anti-entropy.
  • Don't claim linearizability from R+W>N alone (need real-time + single-copy semantics).

22B. Game Day Playbooks​

#DrillInjectDetectMitigateVerify
GD-1One replica downKill 1/NElevated latencyW=2 still worksDurability holds
GD-2Dirty read riskRead R=1 after W=2Version skewRaise R or repairConsistent read policy
GD-3Partial writeCrash after 1/W acksHinted / repair backlogRead repairConvergence

GD-1 — Replica loss​

23. Strong Answer Example​

Question: "We have N=3, W=2, R=2. Are our reads linearizable?"

Answer this as a 45-minute design discussion using the PRACTICE framework. Below is how a strong student sounds aloud—not necessarily, and R+W>N ≠ linearizability.

PRACTICE interview answer map for N=3 W=2 R=2 linearizability

Figure A: PRACTICE map — Problem → Requirements → Assumptions → Capacity → Topology → Invariants → Constraints → Evolution.


Student interview script (PRACTICE)​

P — Problem framing​

"N=3, W=2, R=2 means R+W>N—read and write quorums intersect. That's a strong freshness argument for completed writes when we merge versions under strict quorum.

Linearizability is stricter: every operation appears to take effect at a single point between its start and end, in real time. A read that starts after another client's write completes must see that write.

Short answer: No, not necessarily. We likely have quorum intersection freshness, not linearizable reads—unless we add leader/consensus/SERIAL-style mechanisms."

R — Requirements​

What the interviewer might meanWhat I'd clarify
"Consistent" / "always see latest"Latest completed write via quorum? Or true linearizable?
Read-your-writes after own putOften OK with R+W>N + merge on same client path
Cross-client real-time orderNeeds linearizability (or session + sync), not quorum alone
Survive 1 replica failureYes for liveness: still form W=2 / R=2 with 2 of 3 up

"I'd ask: strict vs sloppy quorum? Version merge on the coordinator? Hinted handoff? Cassandra CL vs SERIAL?"

A — Assumptions (state aloud)​

AssumptionWhy it matters
Strict quorum (preferred replica set)Sloppy/hints can break intersection
Coordinator merges all R responses by versionReturning one arbitrary replica can still be stale
Write ACK means W replicas durably appliedAsync apply inside W set weakens the story
No claim of global real-time orderIntersection ≠ linearizability
W > N/2 also (here W=2 > 1.5)Overlapping write quorums for write-write safety

"Under those assumptions: after a write completes, a later quorum read with merge should see a value at least as new as that write. That's still not linearizability for concurrent overlapping ops."

C — Capacity (cost tradeoff)​

QUORUM R=2, W=2 (N=3) → ~2× replica RTT; good availability (tolerate 1 down)
ALL / sync to N=3 → higher write latency; stronger durability story
SERIAL / LWT / Raft read → linearizable path; lower throughput, contention
ONE / LOCAL_ONE → fast; no intersection guarantee

"I'd keep QUORUM for most reads/writes and pay for linearizable only on money/inventory/fencing keys."

T — Topology (draw this)​

Quorum intersection vs linearizability for N=3 W=2 R=2

Figure B: Left — R+W>N intersection can catch the latest completed write. Right — linearizability also needs real-time order across clients.

When N=3 W=2 R=2 is not enough for linearizability

Figure C: Sloppy quorum / missing version merge break the freshness story; true linearizable needs SERIAL/LWT, leader, or sync replication.

MechanismWhat you get
R+W>N + version merge + strict quorumIntersection freshness for completed writes
Sticky / session tokenClient-centric RYW (still not global linearizable)
Cassandra SERIAL / LWT (Paxos)Linearizable compare-and-set / serial reads
Raft/etcd single-key reads via leaderLinearizable (with correct read path)
Sloppy quorum + hinted handoffAvailability ↑; intersection assumptions broken until repair

I — Invariants (safety)​

"I'd nail the invariants on the whiteboard:

  1. R+W>N → every read quorum intersects every write quorum (set overlap).
  2. W > N/2 → write quorums intersect each other.
  3. Merge versions across all R replies — required; intersection alone isn't enough if you pick a random replica.
  4. Linearizability is not implied by (1)–(3)—need real-time order / consensus / leader.
  5. Sloppy quorum / lost hints can violate the overlap story we just claimed."

C — Constraints (second C)​

ConstraintDesign response
Partition / one replica downStill form R=2 or W=2 with 2 live nodes
Multi-DC latencyLOCAL_QUORUM vs EACH_QUORUM—document weaker cross-DC story
Ops use hinted handoffTreat as EC debt; don't call it linearizable
Product says "strongly consistent"Clarify: quorum freshness vs linearizable; upgrade hot paths
Coordinator races / concurrent writesQuorum merge ≠ single global order without consensus

E — Evolution (prove it)​

Phased delivery:

PhaseDeliverable
M1Document per API: QUORUM freshness vs linearizable required
M2Enforce version merge + read repair on quorum reads
M3Disable sloppy for critical keys / alert on hint backlog
M4SERIAL/LWT or Raft for keys that need true linearizability
M5Jepsen-style / linearizability checker on critical workload

Failure modes:

FailureMitigation
"Yes, R+W>N so we're linearizable" (wrong)Teach intersection ≠ real-time order
Coordinator returns one of R without mergeAlways take max version / reconcile
Sloppy write during partitionStrict quorum reject or accept EC + repair
Concurrent write in flightDon't claim linearizability; use consensus for that

Observability: CL mismatch alerts, hint queue depth, read-repair rate, stale-read canaries (write then cross-client read), SERIAL contention metrics.


Closing line (interview)​

"So: N=3, W=2, R=2 is not enough to claim linearizable reads. R+W>N plus version merge under strict quorum gives intersection freshness for completed writes. Linearizability needs real-time order—I'd use SERIAL/LWT, a leader/consensus read path, or sync replication for those keys, and I'd document the rest as quorum-consistent, not linearizable. I'd also ask about sloppy quorum and hinted handoff, because those quietly invalidate the overlap story."

Scoring signals​

StrongWeak / red flag
"Not necessarily" + names linearizability"Yes, R+W>N so always consistent"
Intersection vs real-time orderConflates quorum with linearizability
Mentions version mergeIgnores merge / pick-any-replica
Flags sloppy / hintsAssumes perfect replicas always
Path to SERIAL / Raft / leaderNo upgrade story when product needs strong
Per-key consistency levelsOne CL for everything

Compact outline (if time-boxed to 2 minutes)​

"No. R+W>N means quorums intersect—with version merge and strict quorum you get freshness for completed writes, not linearizability. Linearizability needs real-time order: SERIAL/LWT or consensus leader. Ask about sloppy quorum and hints. Document quorum freshness vs linearizable per API."

24. Weak Answer Example​

Question: "We have N=3, W=2, R=2. Are our reads linearizable?"

"Yes, R+W is greater than N so reads are always consistent."

Why weak / red flags: Conflates quorum intersection with linearizability; ignores version merge, concurrent real-time order, sloppy quorum, and formal definitions—classic interview trap on Dynamo-style systems.

25. Hands-On Exercise​

Lab: labs/lab-004-replicated-kv-store/ — replicated KV on :8095

cd labs/lab-004-replicated-kv-store
go test ./... -v
docker compose -p lab004 -f docker/docker-compose.yml up --build -d
chmod +x scripts/demo_kv.sh && ./scripts/demo_kv.sh
StepEndpointWhat happens
1PUT /v1/keys/user:42Write to W=2 replicas on routed shard
2GET /v1/keys/user:42Quorum read — highest version
3GET /v1/keys/{key}/replicasInspect per-replica versions
4POST /v1/chaos/replica-downSimulate replica failure
5GET /v1/keys/{key}?repair=trueRead repair lagging replicas

Swagger: http://localhost:8095/docs

Engineer guide: how the local stack works​

  1. 3 shards × 3 replicas — in-process simulation; each shard has independent N=3, R=2, W=2.
  2. Routing — hash(key) % 3 picks shard (consistent-hash stand-in from Lab 001).
  3. Write quorum — PUT writes to first W available replicas; fails if fewer than W alive.
  4. Read quorum — GET reads R replicas, returns max version (Dynamo-style).
  5. Read repair — ?repair=true pushes latest version to lagging replicas without incrementing version.

Pairs with Lab 003 Raft — production systems use Raft per shard instead of hand-rolled quorum.

Build-from-scratch exercise (optional)​

  1. Implement quorum intersection calculator: given N, R, W, return whether R+W>N.
  2. Simulate 3 replicas; random W and R sets; verify intersection empirically.
  3. Configure Cassandra or local docker cluster; run write with QUORUM, read with ONE—observe stale read.
  4. Write ADR: CL matrix for your service's read/write paths.

26. Knowledge Check​

  1. Minimum intersection size when R+W>N? (At least R+W-N, often 1.)
  2. Majority quorum size for N=5? (3.)
  3. Sloppy quorum purpose? (Availability when preferred nodes down.)
  4. Read repair when? (Read detects version mismatch among quorum.)
  5. R+W>N sufficient for linearizability? (No.)
  6. Dynamo sibling values cause? (Concurrent partitioned writes.)

27. Flashcards​

#FrontBack
1R + W > NRead/write quorums intersect (pigeonhole).
2W > N/2Any two write quorums intersect.
3Replication factor NTotal replicas per partition.
4Sloppy quorumFallback replicas outside preference list.
5Hinted handoffQueue write for down replica; deliver later.
6Read repairUpdate stale replica during read.
7Anti-entropyBackground replica reconciliation.
8Gifford (1979)Early quorum work on replicated data.
9Dynamo (2007)Sloppy quorum, vector clocks, AP design.
10vs Raft majorityQuorum overlap ≠ total ordered log.
11LOCAL_QUORUMQuorum scoped to local datacenter.
12Version mergeCoordinator picks latest among R responses.

28. Cheat Sheet​

QUORUM BASICS
N = replicas
R = read quorum size
W = write quorum size
R + W > N → read ∩ write ≠ ∅
W > N/2 → write ∩ write ≠ ∅

FRESH READ (strict, idealized)
- R+W>N + version merge on R nodes
- NOT linearizability

DYNAMO AP PATTERNS
- Sloppy quorum + hinted handoff
- Read repair + anti-entropy
- Vector clock siblings

CASSANDRA CL (examples)
ONE, QUORUM, ALL, LOCAL_QUORUM

VS CONSENSUS
- Raft: majority + single log order
- Dynamo: overlap + eventual merge

FAILURES
- Stale ONE reads
- Hint loss
- Partition divergent writes

30. References​

Primary sources​

Engineering​

  • Apache Cassandra documentation — consistency levels and tunable consistency (verify current revision).
  • Martin Kleppmann, Designing Data-Intensive Applications (O'Reilly) — Ch. 5–6 replication and quorums.
  • Abadi, D. (2012). "PACELC: Beyond the CAP Theorem." — latency vs consistency tuning.

Distinction​

Claim typeSource
R+W>N intersectionCombinatorial proof; Gifford; textbooks
Sloppy quorum behaviorDeCandia et al. (2007)
Cassandra CL semanticsApache Cassandra project docs
Linearizability requires more than quorumHerlihy & Wing; engineering interpretation