jonnify·bcs /bcs/cache

B4 · EchoCache — manuscript Part IV

Cheap to read, never wrong.

Part II gave the names a home and Part III put them in motion; Part IV makes reading them cheap without making them wrong. EchoCache is a near-cache — an L1 of declared ETS tables in front of the L2 Valkey the systems already share — and its one-line case is the part's title: branded keys, local speed, bus-driven coherence.

The comparison set is real and named — Valkey's own server-assisted tracking, Nebulex's near-cache topology, Cachex beneath it — and every member shares one shape: coherence is deletion. EchoCache says something stronger — a newer row exists for this name, minted at this time — and because the version is a branded identity, newer-wins is a comparison of two names. Each module below teaches one written chapter, its committed rung quoted verbatim on the page.

The Part IV arc — five chapters in reading order. Select a node to read its thesis.
4.1 cache-aside 4.2 coherence 4.3 the ring 4.4 the journal 4.5 referee
readout · Select a chapter to read its thesis. Reading order runs left to right; B4.1 lands the declared L1 over the shared L2.
§1

The five modules

content/bcs4.1.md – bcs4.4.md

A module card becomes a link when its pages ship; the dives per module are fixed in the chapter spec, and the reading order is the arc above. Part IV is written through its fourth chapter — B4.1 through B4.4 are buildable, each with a frozen rung; B4.5 waits for its manuscript chapter.

§2

The laws of the part

content/bcs4.md

Part IV states six laws and holds every chapter to them. They are the manuscript's, named here so the modules below read as applications of a rule rather than a list of features.

LAW 1

Declared, not discovered

Every L1 table is declared per kind with its TTL, size bound, and coherence mode; the operator enumerates every cache in the node the way they enumerate stores. A cache that appears wherever a developer was impatient is a leak with a hit rate.

LAW 2

One fill per herd

A miss does not stampede the L2 or the system of record: concurrent misses on a key coalesce onto a single in-flight fill, and the herd reads the one answer. The thundering-herd drill is a gate, not an anecdote.

LAW 3

Coherence is a message about a name

Invalidation carries the branded key and the writer's mint-time version, nothing else. Newer wins by comparing identities; there is no coordinator, no lock, and no clock but the one already inside every id.

LAW 4

Two lanes, named per surface

The broadcast lane rides the bus's wake fabric for latency and accepts fire-and-forget; the job-backed lane pays queue overhead to buy at-least-once when a stale read costs money. Each surface names which lane it rides.

LAW 5

The single writer applies the stream

Per cache, coherence application is one owner draining an ordered ring — batched, allocation-light, and race-free by construction, because a stream applied by one writer needs no locks to stay ordered.

LAW 6

Replay beside the bus, never WAL inside it

Decision D-2 stands: the bus remains volatile. The memory that must survive a node — provenance, checkpoints, last-applied versions — lives in per-group journals beside the consumers, and recovery replays them.

§3

The floor under the floor

committed outputs, quoted verbatim

Part IV inherits a measured floor, not a hope. The bus that carries coherence has a committed profile, the contract under its messages is a gated artifact, and the stores being cached already guard themselves — so a cache layered above them is wrong only in the benign direction: stale for a bounded moment, never a fabricated row. The four chapter rungs on file, each an executable check and a frozen transcript:

content/echo_data/runtimes/elixir/ · the Part IV chapter rungsfrozen
bcs_rung_4_1_check.out   cache-aside at ETS speed         PASS 6/6
bcs_rung_4_2_check.out   coherence by mint time           PASS 6/6
bcs_rung_4_3_check.out   the single writer and the ring   PASS 6/6
bcs_rung_4_4_check.out   the lane that remembers          PASS 6/6

The inherited floor is the Part III record, quoted by the preface: the bus's end-to-end median 0.3 ms bus vs 8.8 ms rival, a parked consumer costing 0 commands while it waits, the conformance record's fourteen of fourteen contracts hold, and the torn-write drill landing qty 12 once, never 17 -- and the order completes. What the part will not do is stated too: the bus gains no persistence here — D-2 stands, the journal is beside the bus, never inside it — and Litestream is named as the off-box layer and deliberately not implemented.

§4

Up next

built as the manuscript ships
§5

The doors

the sibling courses
§6

References

sources · related

Sources

Related