B4.2 · dive 2 of 3
One fill per herd.
A hit is a caller-side ETS lookup that never enters the owner; a miss coalesces a herd onto a single in-flight load; expiry is jittered; a full cache passes through.
The idea
echo_store · table.exThe read path never enters the owning process. A hit is a caller-side :ets.lookup against the public L1 table, so reads cost nothing but the lookup and scale with schedulers, not with one GenServer’s mailbox. The owner is consulted only on a miss, and that is where the second law holds: one fill per herd. Concurrent misses on the same key coalesce onto a single in-flight load — the first caller’s flight checks L2, falls through to the declared loader, writes both layers, and every waiter reads that one answer.
Expiry is deliberately uneven. Rows expire on a jittered clock, ttl plus or minus ttl times a jitter fraction, so a cohort filled together never expires together and a herd never forms at the second boundary; a sweeper reclaims dead rows on a fixed tick, so memory is bounded by the declaration rather than by luck. The cache’s footprint is what its tables declared, held to by a clock, not an accident of traffic.
A full cache degrades, it does not fail. When the table is at capacity and nothing has expired, a fill still serves its caller and skips the insert: the cache becomes a pass-through, answering from L2 and the loader without caching the result, never refusing a read. And the kind law runs before either layer is touched — a wrong-namespace id is refused at the door, the series’ oldest rule riding into the cache unchanged.
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
- Erlang/OTP — the ets modulethe public read-concurrent L1 table a hit reads directly
- Söderqvist — A new hash table (Valkey, 2025)the L2 the near-cache fronts, costed at rest
- Helland — Life Beyond Distributed Transactions (CIDR 2007)the entity addressed by a key, cached close to its use
Related
- BCS — the course homethe law, the id anatomy, the chapter map
- Echo Persistencethe durable floor beneath the bus