Continue where you left off ×
How you know it holds: Jepsen, simulation and models
Who Holds the Pen · Open board
The group that must agree on who holds the pen. This lesson asks how you would ever know that such a group, or any copy-and-failover design, keeps its promise on the worst day.
Before you start. You need The log is the truth (event sourcing and CQRS) : a log of events is the truth, and the state is what you get by replaying it. You need The copy clerks (database replication) : one primary takes the writes and a backup copies them a moment later. You need What did the database promise? (consistency models) : a write the database says it kept is acknowledged , and losing one is the worst failure. And Who holds the pen (consensus & Raft) showed how a majority picks one writer. Here we do not design anything new. We test a design.
The idea in 30 seconds
A test that passes on a good day says nothing about a bug that needs a bad order of events.
Fault injection breaks the system on purpose, many times, and checks a rule that must always hold, called an invariant.
A deterministic simulation fixes every random choice from one seed, so any failure replays exactly.
A Jepsen-style history check records what clients did and saw, and finds acknowledged writes that are missing.
A model checker visits every reachable state of a small model, so it can prove the rule for that model and give the shortest bad trace.
None of these proves the real system. Each trades coverage against how much it needs to know about the inside.
Read the story
Lesson 37 of 115 in System Design
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year .
See plans Already a member? Sign in
Or start free : a free account opens lessons 2 and 3 of every track.
In this lesson The test that passes, and the bug that stays The design under test, as a few lines Fault injection: break it on purpose, many times Simulation: same seed, same run, every time A history check: judge only what clients saw Model checking: look at every state, not a sample Terms it explains: acknowledged, primary, backup, failover, buggy, safe, invariant, Fault injection, deterministic, seed, deterministic simulation testing, history, model checker, Common mistakes, commit, consensus, election timeout, heartbeat, leader / follower / candidate, log entry, Paxos, quorum / majority, Raft, split-brain fence, term.
Review System Design
Mark as read Saved in this browser, and to your account when you sign in.