B5.2 · dive 2 of 3
The lazy reader.
Replication is lazy and partial: a reader fetches only the pages a read touches, the newest from the L1 ETS head, at a serializable snapshot.
The idea
echo_store · graft/reader.ex, table.exReplication here is lazy and partial, the two words that separate this floor from a backup. A reader does not replay a log or wait for a full file to land; it fetches only the pages a read touches, on demand, at a chosen snapshot. Decoupled metadata and data let a replica spin up at once — it learns which pages exist without holding them, and pulls a page the moment a read asks for it.
The hottest page is already in memory. The reader’s L1 is EchoStore.Table, the same read-concurrent ETS cache that fronts Part IV, used here as a write-through head page: a commit writes the head page through to ETS, and a read of the newest page is a caller-side lookup that never touches disk or the remote. The cache and the floor share one structure, so the tier that makes reads fast is the tier that keeps the engine’s head durable.
Consistency is not traded away for laziness. Reads run at a snapshot with serializable isolation, so a partial view is still a correct one — a reader sees a single point in time across every page it pulls, never a mix of an old page and a new one. The floor fetches little and late, and what it returns is exactly what a full, eager replica would have returned, only without the bytes in between.
The doors
the sibling coursesEchoMQ — the protocol, in depth
The bus B3 narrates, taught rung by rung: the keyspace, the Lua inventory, and the 3.0 Stream Tier — XADD, XREADGROUP, XACK — with conformance on Valkey.
Redis Patterns Applied
The substrate patterns under the bus: sorted sets, atomic Lua moves, locks, and streams — the judgement layer.
/echo-persistenceEcho Persistence — the durable floor
Beneath the volatile tiers: the Graft page engine built twice, the commit-LSN loop, and the stream archive on Tigris. Where Part I says state lives somewhere, this says where it lives durably.
References
sources · relatedSources
- orbitinghail — Graft: lazy, partial, strongly consistent replicationthe page-replication engine echo_store builds natively on the BEAM
- Ong — CubDB, an Elixir embedded key-value storethe append-only immutable B-tree the volume commits onto
- Helland — Life Beyond Distributed Transactions (CIDR 2007)entities made durable and addressed across a boundary
Related
- BCS — the course homethe law, the id anatomy, the chapter map
- Echo Persistencethe durable floor beneath the bus