R8.07 · Capstone — the door to the EchoMQ course
Thirty patterns, one thread.
The course capstone: nine chapters and thirty Redis patterns, each proven once in the real BCS build — EchoMQ backed by Valkey, EchoStore in front, codemojex the worked consumer — read back as one line. The thread that ran through all of it is the branded id.
Grounding: the real surfaces the course taught — the branded JOB id and the emq:{q}: keyspace (echo/apps/echo_mq), EchoMQ.Jobs.enqueue/claim, EchoMQ.Lanes.claim/3, EchoMQ.Keyspace.slot/1 (slot("123456789")==12739), AOF durability (infra/valkey/conf/valkey.conf, appendfsync everysec), EchoStore (echo/apps/echo_store), and the consumer Codemojex.Guesses.submit/3 (echo/apps/codemojex). The branded-id vectors are from echo/apps/echo_data branded_id self_check. The engine is Valkey.
A capstone is not a new pattern. It is the whole course read back as one line: thirty patterns, nine chapters, and one consistent claim — a pattern is worth learning only when you can apply it, so each one landed twice, once as the pattern and once as the real move it became.
The arc — nine chapters, thirty patterns
the course · R0–R8The course moved from a single key to a production tier, and each chapter landed its patterns on a real surface you can open on disk — none of it invented for the page.
| Chapter | The patterns | Applied surface |
|---|---|---|
| R0 · Catalog | the thirty patterns mapped; the frame that holds them — problem, solution, trade-off, place | the catalog itself |
| R1 · Caching | cache-aside, stampede control, client-side caching, sessions | EchoStore — L1 ETS over L2 Valkey, coherence by mint time |
| R2 · Coordination | atomic operations, locks, the fencing token, the inline Lua move | one EVAL over keys that share a slot |
| R3 · Reliable queues | the state machine, at-least-once delivery, claim, lease, retry | EchoMQ.Jobs — a branded JOB claimed under a server-clock lease |
| R4 · Time & priority | delay sets, priority queues, the scheduled job promoted on time | the schedule set on the bus |
| R5 · Streams & events | append-only events, consumer groups, the replayable log | the retained, ordered history |
| R6 · Flow control | rate limiting, fair lanes, groups, batches, worker concurrency | EchoMQ.Lanes via Codemojex.Guesses.submit/3 |
| R7 · Data modeling | the primary-database trade, encodings, secondary indexes, time series | the structure chosen for the access pattern |
| R8 · Production | kernel settings, AOF durability, the pool, reconnect, colocation, telemetry | valkey.conf · EchoMQ.Pool · EchoMQ.Keyspace · EchoMQ.Meter |
Thirty patterns, each proven once in the real BCS build. Every figure in the course was quoted
from code or config — a real emq:{q}: key, a script verb, a valkey.conf
directive, an EchoStore figure — never a benchmark dump, never an invented surface.
The through-line — one branded id, carried unchanged
echo_data/branded_id.exThe course had a single thread, worth naming on its own: the branded id. One 14-character name — a 3-character uppercase namespace and 11 Base62 characters carrying a 63-bit snowflake — minted once at the consistent core and carried unchanged to the available periphery. Every chapter handled that one id under a different aspect, and it has four properties.
Source truths, not measurements (echo/apps/echo_data branded_id self_check) —
placement("USR0KHTOWnGLuC")→234878118 ·
parse("USR0NgWEfAEJfs")→{:ok, "USR", 320636799581945856} ·
decode("USRzzzzzzzzzzz")→:error (an overflow is refused, not wrapped). The USR
namespace is the manuscript's illustrative figure; a codemojex example uses
PLR / ROM / GAM / GES / JOB.
# the boot-asserted vectors — source truths, not benchmarks placement("USR0KHTOWnGLuC") => 234878118 # placed: native & pure agree parse("USR0NgWEfAEJfs") => {:ok, "USR", 320636799581945856} decode("USRzzzzzzzzzzz") => :error # an overflow is refused, not wrapped
Notes on ValkeyThe placed property is a Valkey cluster fact:
every key of a queue carries the queue's {q} hash tag, so they all hash (CRC16 of the brace bytes)
to one of the 16384 cluster slots and co-locate. That is what keeps a multi-key claim or atomic Lua script
legal (no CROSSSLOT) and lets EchoMQ.Keyspace.slot/1 route client-side —
valkey.io/topics/cluster-spec.
That fourth property, conformant, is what makes a polyglot worker fleet possible: if every runtime agrees on the id and its placement, a Go worker and an Elixir worker can drain the same bus. The shipped bus is Elixir; the polyglot fleet is the conformance target the wire protocol and the id contract make reachable, demonstrated in the EchoMQ Proof pillar.
What you can now do
the course · outcomesThe course's outcomes, stated plainly. After these thirty patterns you can:
- Choose the right pattern and name its failure mode. Cache-aside risks staleness; at-least-once delivery risks a duplicate; a fixed-window limiter risks a burst at the boundary. Knowing the trade is the skill — the pattern is the easy half.
- Read a real atomic Lua move and say why the multi-key change is one script. The keys
share a slot (the
{q}hashtag), so the change is atomic andCROSSSLOT-safe — oneEVAL, not a transaction that can interleave. - Build a reliable, scheduled, observable, rate-limited queue. The claim-with-lease, the
retry with a fencing token, the delay set, the telemetry tree, the token bucket — each a pattern you
saw applied, and
Codemojex.Guesses.submit/3the worked consumer that composes them. - Operate the tier as a system of record. AOF durability (
appendfsync everysecbounds worst-case loss to about a second), a pool sized for round-trip-hiding rather than cores, a reconnect discipline that fails in-flight callers rather than replay them, cluster colocation by hashtag, and a telemetry surface a Prometheus or OpenTelemetry exporter can read.
R3 enqueue EchoMQ.Jobs.enqueue(conn, "cm", JOB, payload) ← a branded JOB on the bus R6 fair lane Codemojex.Guesses.submit/3 → Lanes.enqueue/5 ← one guess, the PLR lane R8 durable valkey.conf: appendonly yes / appendfsync everysec ← AOF, the durability dial R8 placed EchoMQ.Keyspace.slot("123456789") == 12739 ← one of 16384 cluster slots
The skill the course built is judgement, not recall: a pattern, the failure it guards against, and the one real move it becomes — from a single enqueue to the durability dial that keeps it across a restart.
The door — the system that applies them
/echomq · six pillarsRedis Patterns Applied taught the patterns. The dedicated EchoMQ, In Depth course teaches the system that applies them, in depth, across its six pillars — all built. Every Redis pattern here is one move the EchoMQ protocol makes; the protocol governs all of them at once, and the polyglot fleet — one bus drained by workers in several runtimes — is the conformance target it makes reachable.
Thirty Redis patterns, taught applied: cache-aside and stampede control (R1), atomic Lua and the fencing token (R2), the reliable-queue state machine (R3), schedules (R4), the replayable log (R5), fair lanes and flow control (R6), the modeling trades (R7), and production operations (R8). Each landed on a real surface.
The same patterns as one owned protocol: /echomq/overview (the bus, the three roles),
/echomq/protocol (the emq:{q}: keyspace, the Lua layer, branded ids),
/echomq/queue (jobs, lanes, claim, retry, schedule, flow), /echomq/bus (the
retained event log), /echomq/cache (the near-cache), and /echomq/proof
(conformance and the measurement plane — the polyglot-fleet target).
The natural next course is the system itself: the patterns are the vocabulary, the EchoMQ protocol is the grammar that composes them, and the six pillars are where each move is taught in depth on the real shipped code.
EchoMQ, In Depth — the dedicated course
One shipped Valkey-native job system you own, taught across six built pillars: overview · protocol · queue · bus · cache · proof. Every pattern in this course is one move the protocol makes; the next course is the protocol itself, in depth on the real code.
/echomq/protocolThe protocol foundation
The owned emq:{q}: keyspace, the inline Lua layer, immutability and the branded id —
the typed-ordered-placed-conformant thread of this capstone, taught as the contract.
The Queue pillar
Distribute work: jobs, fair lanes, the claim with a lease, retry, the schedule set, and the flow control R3, R4 and R6 grounded — rung by rung on the shipped bus.
/echomq/proofThe Proof pillar
Conformance, telemetry, and the measurement plane that proves the contract — where the polyglot fleet, the conformance target named here, is demonstrated.
/bcsThe Branded Component System
The architecture the whole stack is built to. The branded id is the thread of this capstone because BCS makes it the thread of the system: entity is identity, component is data, system is a gated process.
/echo-persistenceThe durability floor
The dial beneath the bus. R8 named AOF as the engine-level durability dial; this is the tier below it — a durable local page engine and a portable remote, from holding nothing to commit-per-record off-box.
References
sources · relatedSources
- Valkey — Cluster specification — the
{q}hash tag forces a queue’s keys onto one of the 16384 slots, the placement property the atomic Lua move and cluster colocation depend on. - Valkey — Persistence — AOF as the single source of durability;
appendfsync everysecbounds worst-case loss to about a second, the production durability dial R8 grounded. - Valkey — EVAL — the scripting primitive behind every atomic multi-key move in the course; one script, declared keys, no interleave.
- Redis — Redis patterns — the pattern catalog the course is built on, each entry taught here applied to a real system.
- llms.txt — the convention — the route-mirrored markdown this course keeps beside every page, one source of record per route.
Related in this course
- R0 · The pattern catalogthe thirty patterns and the frame that holds them
- R1 · Cachingread-heavy work served from EchoStore
- R3 · Reliable queueswork that survives a crash, the EchoMQ.Jobs state machine
- R6 · Flow control & scalekeeping the queue stable under load
- R8 · Production & operationsrunning the tier as a system of record
- EchoMQ, In Depththe dedicated course — the system that applies every pattern here
- EchoMQ · Proofconformance and the measurement plane; the polyglot-fleet target realized
- The Branded Component Systemthe architecture law the whole stack is built to
- The durability floorthe dial beneath the bus