The Desi Architect
Notes / Docker Sandboxes / Tunable Consistency: Quorum Reads, Writes & Read Repair (Cassandra Style)
Docker Sandboxes · Tier 4: Architect & Chaos · Lab 53

Tunable Consistency: Quorum Reads, Writes & Read Repair (Cassandra Style)

Master Dynamo and Apache Cassandra style tunable consistency. Prove mathematically why R + W > N ensures read freshness when reads overlap acknowledged writes, see why quorum overlap is not linearizability, reproduce the stale read anomaly when R + W <= N, observe Last-Write-Wins conflict resolution with background Read Repair, and inspect Hinted Handoff recovery.

Time30 minutes
StackDynamo & CassandraPorts 19042
MemoryAbout 300 MB
Before thisLab 24PostgreSQL Synchronous vs Asynchro
Verified runWindows, Mac, LinuxBash and PowerShell
  1. 1PrepareWhat you will learn
  2. 2PredictGuess before you run
  3. 3RunStep by step
  4. 4ObserveWhat you should see
  5. 5Break itChange one thing
  6. 6Clean upLeave nothing running
On this page
  1. 00 / What You Will Learn
  2. 01 / Why It Matters
  3. 02 / What We Are Building
  4. 03 / Words You Need
  5. 04 / Predict First
  6. 05 / Step by Step
  7. 06 / What You Should See
  8. 07 / Look Inside
  9. 08 / Break It, Fix It
  10. 09 / In Real Projects
  11. 10 / Interview Corner
  12. 11 / Clean Up

00 /What You Will Learn

By the end you will be able to
  • Understand how tunable consistency allows per-query tradeoffs between latency and consistency.
  • Calculate quorum overlap conditions (R + W > N) using the Pigeonhole Principle.
  • Explain why quorum overlap guarantees read freshness for acknowledged writes but is not linearizability.
  • Reproduce the stale read anomaly when queries operate under weak consistency (R + W <= N).
  • Observe Last-Write-Wins conflict resolution during multi-replica reads.
  • Inspect automated background Read Repair healing inconsistent storage nodes.
  • Verify how Hinted Handoff captures and replays writes for partitioned replicas upon reconnection.
What is simulated in this lab

In this lab the Cassandra cluster is a small Python simulation of the idea. It teaches the behaviour, not the product.

Before you start

Finish Lab 24 (PostgreSQL Sync vs Async Replication) and Lab 25 (Consistent Hashing Ring) first. You should understand data replication, eventual consistency, and how distributed hash rings route partitions to replica nodes. Docker Desktop must be running.