Lab / 03 · distributed systems
Kill the leader.
Watch Raft recover.
Five real Web Workers on your CPU, each running the Raft consensus protocol — election timeouts, RequestVote, AppendEntries, term rules, the safety checks. They elect a leader among themselves. The button calls worker.terminate() on whichever one won: an operating-system thread dies, and the survivors have to notice and elect again.
safety invariants: 500/500 schedules pass in CI · nothing violated in this session
Cluster
Committed 0
—
A majority is more than half the ring. Below it, a correct cluster stops.
Nobody is in charge until one of them is elected. Keep pressing: at three of five the margin is zero, and at two the cluster correctly refuses to elect or commit anything. Open DevTools → Sources → Threads and watch one disappear.
Term0
Leader—
Alive—
Quorum needs—
Committed entries0
The last recovery, decomposed
performance.mark() · checkable in DevTools
—
Total recovery
Detect—
Campaign—
First append—
Term—
Votes—
Winner—
Committed entries lost—
of the wall clock was detection.
—
Want this measured on your infrastructure? → Architecture audit
Distribution over this session
a single number proves nothing — press the button again
no recovery measured yet
—
Runs0
Median—
Fastest—
Slowest—
The wire
- messages sent
- 0
- delivered
- 0
- dropped
- 0
- reordered
- 0
- in flight
- 0
- measured frame jitter
- —
- real postMessage hop
- —
- injected link τ
- —
Link delay is derived from your own measured frame jitter. That is why the recovery number differs between two machines, and between two runs on one machine.
This run
- seed
- —
- nodes
- —
- quorum
- —
- logical cores reported
- —
- timeout ladder
- —
- partition
- —
- link latency
- —
- message loss
- —
- reduced motion
- —
Attack it
Every parameter is a URL parameter.
Any run you find is a link you can send back to me — the seed reproduces the exact election ladder.
- ?seed=20672
- pin the seed
- ?partition=3,4
- cut nodes 3 and 4 off; the minority must refuse to elect
- ?latency=180
- pin link delay to 180 ms and force churn
- ?loss=0.05
- drop 5% of messages, deterministically under the seed
- ?indep=1
- independent timeouts instead of the φ-jittered ladder — split votes go up
Honest scope
A real protocol at toy scale.
- No snapshotting, no membership changes, no persistence across reload.
- Five workers, one CPU, no network between them — the link delay is injected.
- Election safety, leader completeness, log matching, state-machine safety and no-commit-without-majority are gated in CI over 500 randomised fault schedules and block the deploy if any fails.
- Kill three of five and the cluster stops on purpose: unavailability is the correct answer, not a bug to hide.
Event feed
newest first · capped at 60 lines