Replication, Consistency and Convergence
Copies improve availability only when the read, write, conflict and repair rules are precise. Recorded histories turn vague consistency labels into contracts that can fail a test.
Section 4 of 9 · 14 units · about 64 hours
By the end you can State a consistency contract that accepts or rejects recorded histories, reproduce one violation under partition or failover, and defend the measured latency, availability, staleness, conflict and repair trade-off.
Units
- Leader-follower, multi-leader and leaderless replication4h
- Synchronous and asynchronous acknowledgement, replication logs, positions and lag4h
- Failover, stale-leader risk and replica rejoin and replacement4h
- Stale reads, read-your-writes and monotonic read and write guarantees4h
- Linearizability as a history property and sequential consistency4h
- Causal and eventual consistency, convergence and CRDT vocabulary4h
- Availability under partition, quorum intersection and its membership assumptions5h
- Sloppy quorums, hinted handoff and read repair4h
- Background anti-entropy and Merkle trees for difference localization4h
- Concurrent write conflicts and last-write-wins clock hazards3h
- Version vectors, dotted conflict sets and delete convergence with tombstones6h
- Operation history schema, a single-object reference model and a consistency checker6h
- Deterministic replicated-store simulation with partition, failover and repair schedules6h
- Latency, availability, staleness, conflict, repair traffic and convergence measurement6h
Build it
Mini project · about 16 to 22 hours
Replicated store with checked histories and repair evidence
Extend loglab with configurable replication policies, executable consistency contracts and version-aware repair. Reuse net/, clock/, member/ and storage/ on your machine, keeping controller-driven promotion distinct from consensus and convergence distinct from a legal client history.
- 1Build validated operation histories and independent register witness search in
history/; distinguish sequential consistency from linearizability, pending effects, malformed input and inconclusive search. Compare fixtures with Knossos's register model, retaining witnesses, contradictions and a negative control that drops pending writes. - 2Add configurable write authority, read routing and acknowledgement policies in
replica/. Replay topology-specific partitions against hand-derived contracts; record receipt, persistence, application, replies and lineage-scoped record lag, including a crash before persistence. Preserve explicit event schedules and independent model verdicts before timing runs. - 3Implement controller-driven promotion, stale-epoch rejection and snapshot-plus-suffix bootstrap. Check divergent-leader rejoin, empty replacements and retention gaps against a single-node replay oracle; preserve lost acknowledged suffixes. Add session frontiers with wait-or-fail routing, monotonic reads and writes, writes-follow-reads and context-loss regressions.
- 4Implement dependency visibility, sibling dominance, restart-safe actors and versioned deletes against an event-ancestry oracle. Preserve skewed and equal-tag LWW losses, sibling-policy comparisons and unsafe-reclamation regressions. Retain Gossip Glomers Challenge 4 histories separately from dependency checks; optionally test incoming-context dotted replacement.
- 5Implement fixed-membership read write-back and fixed-preference sloppy quorums; check pending-write inversion and disjoint fallback sets with your register checker. Add recipient-aware delayed, duplicate hinted handoff and version-aware read repair; keep an unread-key negative test and distinguish partition stalls from safety violations.
- 6Build canonical, ordered, domain-separated Merkle comparison over versioned snapshots, including cold keys and tombstones. Compare differences and repaired state with a full-scan oracle; retain separate rebuild, comparison and transfer counters. Replay deterministic crash, failover, delete and duplicate-repair schedules without erasing earlier history violations.
- 7After correctness gates, compare consistency, conflict and repair policies across repeated matched runs on your machine; validate extraction against hand-counted traces. Retain versions, workloads, seeds, latency distributions, outcomes, staleness, conflicts, repair bytes, acknowledged loss and convergence. Keep Gossip Glomers 3d/3e results separate, including negative trade-offs.
What you hand in
- The
replica/implementation with explicit contracts, recovery boundaries and reusable deterministic schedules infaults/. - Validated
history/fixtures, Knossos comparisons, independent model verdicts and negative-control regressions intests/. - Raw traces and repeated-run comparisons in
reports/, separating simulated ordering, measured timing, unsuccessful work and unobserved convergence.
How to check it
- Self-grade with the rubric below
- Knossos register model through Jepsen's pinned checker tutorial
Cross-check register fixtures on your machine; retain model versions, outcome translation and verdicts. No remote provisioning is needed.
- Gossip Glomers Challenge 4: Grow-Only Counter
Retain Maelstrom histories and final-count verdicts; these do not establish causal visibility or intermediate-read linearizability.
- Gossip Glomers Challenge 3d: Efficient Broadcast, Part I
Retain broadcast correctness and efficiency results separately from deterministic crash and storage evidence.
- Gossip Glomers Challenge 3e: Efficient Broadcast, Part II
Compare matched broadcast workloads and recheck partitions; distinguish observed stability from client response latency.
How it's graded
History oracle independence
Pass: Your checker agrees with Knossos on legal, illegal and pending-write fixtures, returns witnesses, and separates invalid input and incomplete search from violations.
Great: A deliberately broken pending-write rule fails its negative control; minimized counterexamples identify the violated ordering edge without inspecting implementation state.
Conflict and repair correctness
Pass: Your ancestry oracle checks sibling dominance and deletes; full-scan comparison validates Merkle repair. Tests expose LWW loss, resurrection, sloppy nonintersection and the unread-key limitation.
Great: Metadata-only differences, duplicate handoff and restarted actors remain correct; an optional dotted extension removes only siblings covered by the incoming context.
Measurement honesty
Pass: Hand-counted fixtures validate your extractor before repeated matched runs; raw histories support latency, outcomes, lag, conflict, repair, loss and convergence claims with named versions and workloads.
Great: The comparison preserves a negative regime, separates repair construction from transfer costs and reports pending operations or unobserved convergence rather than inventing completion times.
Resources
- DDIA 2e - Chapter 6 Replication and Chapter 10 Consistency SectionsMartin Kleppmann and Chris Riccomini
Read replication completely, then the consistency-model and linearizability portions of Chapter 10. Convert every named guarantee into allowed and forbidden histories before selecting implementation policy.
- Linearizability: A Correctness Condition for Concurrent Objects (Herlihy and Wing, 1990)ACM TOPLAS (MIT 6.5840 copy)
Read through Section 3.1, as MIT 6.5840 assigns: histories, real-time order and the definition every history check in this section tests. Linearizability is per object, which is why it composes.
- Dynamo: Amazon's Highly Available Key-value Store (DeCandia et al., 2007)Amazon (author copy)
Read the background and system architecture sections: consistent hashing, replication, vector-clock versioning, sloppy quorums, hinted handoff and Merkle-tree anti-entropy. alone does not make it linearizable, and its numbers are 2007 production results.
- MIT 6.5840 - Consistency, Linearizability and Replication PapersMIT PDOS
Use Spring 2026 lectures 8, 12 and 13 plus their Linearizability, Spanner and Chain Replication readings. Write one history question per mechanism and answer it before looking at the discussion material.
- HLD Handbook - Consistency, Quorums, Replication and Anti-EntropyHLD Handbook
Read Part 1 consistency plus Part 2 replication and Part 3 consistency, quorums, CAP and PACELC, clocks and Merkle trees. Use the chapter exercises as oral review after implementing the histories.
- Jepsen Consistency ModelsJepsen
Use the model hierarchy and history definitions to name the exact contract being checked. Check recorded single-register histories with Knossos, which Maelstrom runs for its
lin-kvworkload, and never claim a stronger model than the checker covers. - Gossip Glomers - Broadcast and Grow-Only CounterFly.io and Jepsen
Each challenge runs locally under Maelstrom (v0.2.4; the pages were tested on 0.2.3) with its checker and, where the page says so, the partition nemesis; keep the run directory as the history. Do 3d and 3e (efficient broadcast, with message and latency budgets) and 4 (a grow-only counter over sequentially consistent storage). Explain why convergence alone does not imply linearizability or transaction isolation.
- Session Guarantees for Weakly Consistent Replicated Data (Terry et al., 1994)Cornell course copy
Read the definitions of read your writes, monotonic reads, writes follow reads and monotonic writes and how each is enforced. They hold per session, not system-wide.
- Brewer's Conjecture and the Feasibility of Consistent, Available, Partition-Tolerant Web Services (Gilbert and Lynch, 2002)CMU course copy
Read the model and the asynchronous-network theorem, then the partially synchronous discussion. Availability here means every request a non-failing node receives gets a response, in every fair execution, including executions that lose messages.
- Don't Settle for Eventual: Scalable Causal Consistency for Wide-Area Storage with COPS (Lloyd et al., 2011)Carnegie Mellon University (author copy)
Read the causal+ definition and the dependency-tracking mechanism; causal+ adds convergence to causal consistency, so keep the qualifier.
- Conflict-free Replicated Data Types (Preguica, Baquero and Shapiro, 2018)arXiv
Read it for the state-based and operation-based vocabulary and the delivery assumptions each needs; the implementation belongs to DS-9.
- Consistency in Non-Transactional Distributed Storage Systems (Viotti and Vukolic, 2016)arXiv
Use it as a map of model names and their relations, then confirm any single definition against its primary source.
- Cambridge Concurrent and Distributed Systems Notes (Kleppmann) - Replication and LinearizabilityUniversity of Cambridge (Martin Kleppmann)
Use Chapter 5 (quorums and replication with broadcast) and Section 7.2 (linearizability and ABD) as a derivation workbook: work Exercise 19 (ABD pseudocode) and Exercise 20 (is this execution linearizable?) before writing your own checker.
- Replicated Log and Stream Processor - Replication SliceRoadmap-Final
Add configurable replication, lag, failover, recorded histories, repair and a checked consistency contract. Preserve one violating history and the fix or narrowed claim.
- Vector Clocks Revisited Part 2: Dotted Version VectorsRiak - Russell Brown
Read Sibling Explosion through Dot The clocks for the per-sibling dot and incoming-context replacement rule. This fills the implementation gap left by DDIA's brief dotted-vector mention; use the 2015 example, not its product-default statements as current guidance.
- Building Distributed Systems - The StoreBuild Distributed Systems
Only the first three tasks are free (the key/value interface, client routing and read consistency). Tasks are graded in the browser after login, so treat a pass as a drill and keep your local harness as the evidence.