Unit 12 of 12 · about 4 hours · implement

Deterministic membership and network simulation

Simulation is how one machine tests a cluster. Determinism turns a flaky failure into a reproducible case the learner can argue from.

You'll be able to

  • Build a seeded scheduler with delay, drop, duplicate, reorder, partition and crash faults that replays byte-identical traces.
  • Run membership, detector and lease logic inside it against the DS-2 fault slice of the project list.
  • Reduce a failing run to a seed plus schedule and retain it as evidence.

Covers

Deterministic membership and network simulation
1

Read

In this order, only the parts listed

0 of 2 done

  1. Deterministic faults and durable historiesReplicated Log and Stream Processor - Time and Membership Slice

    Architecture constraints (deterministic schedules, durable event histories, timing-free safety tests) with the failure-injection list entries for this section: split brain attempt, clock jump, stale lease and epoch, and dual process incarnation

    Read the DS-2 slice only. The log, stream and transaction entries belong to later sections.

  2. An external behavior contractGossip Glomers - Unique IDs and Broadcast

    Challenge 3c evaluation: every broadcast value visible on every node after a partitioned run

    Use as the conformance target your simulated broadcast must also satisfy. The Systems unit on distributed histories and deterministic failure simulation built the scheduler itself; extend it here, do not rebuild it.

2

Focus on

  • Seed everything: topology, delays, drops, duplicates, reorder windows, partition intervals, crash and restart points. A run is its seed plus its schedule, and both are retained.
  • Simulate time as an integer tick, never the wall clock. Timers, heartbeats and lease checks read the tick, so reruns cannot drift.
  • Check fencing safety after every transition; no stale token may bypass the storage check. Membership convergence is a liveness goal, not a safety invariant, and needs eventual communication and fair scheduling. Simulated-time reads are valid for detector and lease behavior; do not require real-time bounds to establish fencing safety.
  • Cover the DS-2 slice: split brain attempt, clock jump, stale lease and epoch, dual incarnation, pause and partition healing. Keep raw message and state traces, then shrink the event schedule while preserving the failure. A numerically smaller seed is not a smaller counterexample.
Common mistakes · 3
  • Seeding the network but reading the wall clock in a timeout. One unseeded time source makes reruns diverge and the diff lie.
  • Testing only loss-free schedules. Discovery lives in drops, duplicates, reorder and pause interleavings; the clean run is the smoke test, not the evidence.
  • Keeping summaries instead of raw traces. A minimized case needs the full message history, or the next reader cannot replay the verdict.
3

Try it yourself

Closed-book, before checking anything

Closed-book, state the determinism contract: same seed plus same schedule gives byte-identical message and state traces on rerun. Demonstrate it by running a three-node partition schedule twice and diffing the two trace files, which must match exactly.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Two reruns of one seed disagree. Name three unseeded sources that could explain it.Answer

    Wall-clock reads, an unseeded RNG such as a default hash seed or thread race, and iteration over an unordered set or map. Fix all three before trusting any diff.

  2. 2.May a deterministic test read simulated time, and does a convergence check establish safety?Answer

    Yes. Detector and lease transitions depend on simulated timers, which replay deterministically. Convergence is a liveness property under eventual-delivery assumptions; fencing safety is the separate invariant that stale tokens cannot pass the storage check.

  3. 3.A dual-incarnation bug appears once in fifty seeds. What do you keep?Answer

    The failing seed, the schedule, the raw trace, and the minimized variant. The other forty-nine runs are the coverage note, not the evidence.

  4. 4.Your simulated broadcast converges under every partition schedule. Does 3c still add anything?Answer

    Yes. Maelstrom drives the actual node processes through their JSON input and output with an independent workload and checker. Its network is simulated, not the production TCP stack, so it adds evidence without covering every transport fault.

You're done when

Your rerun diff is empty, the DS-2 fault slice all runs inside the harness, and one minimized case is retained with its seed.

Only when you can do this without notes.

Leads to

Notes

Resources · 2 for this unit, 12 more in the section
  • Gossip Glomers - Unique IDs and BroadcastFly.io and Jepsen · required

    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 challenge 2 (unique IDs under partition with total availability) and 3a to 3c (broadcast, then with partitions). A pass shows uniqueness or convergence in that run, not ordering or recency.

  • Replicated Log and Stream Processor - Time and Membership SliceRoadmap-Final · support

    Add incarnation IDs, logical timestamps, gossip membership, suspicion metrics and fenced ownership. Retain seeds and minimized traces for every false-failure or stale-actor case.

Also in this section