Companion to the kernel walkthrough · design draft 5 · prototypes/kernel-model
The kernel in motion
One order workflow, followed through every part of the proposed kernel; then the three persistence modes side by side, what the kernel does when things go wrong, and a lab where you try to beat the fence.
Proposed design, not approvedPrototype on main: prototypes/kernel-modelNo product code yet
Every part of the kernel is drawn as a physical thing and named. Press Next or Play to follow one order from the HTTP request to the Studio run view. Show seams outlines the three layers and names the interface at each crossing; the glossary below can light up any part.
02
Three persistence modes, side by side
A persistence mode chooses where a turn ends, and a turn commits where it ends; Ephemeral alone writes nothing when the run ends in its first turn and sent nothing. So the mode decides what a run costs and what a crash can lose. Three instances of one request-response workflow run at the same time, one per mode; one set of controls steps all three together, activity by activity.
Add a Wait 5 s after Save quote:
Crash here:
The mode is chosen per workflow by its author. The deployment never changes it.
03
Act two: when things go wrong
The same machine, in three short scenarios. Each starts from its own state; the controls, narration and seams work as in act one. Ids, times, epochs and positions are illustrative.
04
The fence lab: try to make two owners both write
Act two showed one paused owner bounced by the fence. Here you choose the order of events. Node A owns partition 17 at epoch 8 and has a batch to commit; Node B would take the partition if it could. Whatever you choose, at most one of them writes, and a commit lands at most once. The lease is the decided 10 s; times and positions are illustrative.
Node A pauses:
Who reaches the row first:
The answer to A's commit is lost:
Why the check is its own round trip. Sent in one packet, a fence that matched nothing does not stop what follows it: a COMMIT in the same packet would still land. So the owner must see "1 row" before it sends COMMIT, which makes 2 round trips on PostgreSQL. The fence travels one of two ways: in the batch, as EF concurrency tokens on the epoch and the position (the default: 2 round trips, the lease time from the owner's clock), or as its own statement first (3 round trips, the lease time from the database's), which is SQL Server's default since finding E9. Leases decide who should write. The fence decides who can. The invariant: after a take at epoch e + 1, nothing prepared under e commits, and the new owner sees everything that did commit.
Built and measured in the prototype: both ways of sending the fence and their round trips; a response released only after its commit (decided 12 November, and built); the take; the reset after an unknown outcome or a fence that matched nothing; a simulation that injects paused owners and lost answers and checks the invariant after every action; and a mutation check showing that the position decides only when a reset is missing (FINDINGS.md, section 3). Decided: the 10 s lease and the fence in the batch by default; the prototype uses a separate checked fence by default on SQL Server. Illustrative: the times and positions, and the moment Node B tries. The lab draws only the partition row's lock, with the fence sent separately. In a traced PostgreSQL batch, EF wrote messages before the partition fence and a subscription after it. On SQL Server, taking a message lock before the partition lock can cause the E9 deadlock.
05
Dissect the kernel
Each word below is a part of the machine above. Select a card to light that part and dim the rest; select it again to clear. Most light act one's scene; the words act two needs (take, reset, suspect and trial, parked) open their scenario and light act two's; fence, epoch and position light the fence lab. The exploded view pulls act one's three layers apart.
Layer 3 lifts off, layer 1 drops away, layer 2 stays where every guarantee is made.