The Protocol · the foundation
The substrate the
pillars share
The keys, the record, the scripts, and the immutability that make one wire serve three pillars.
Below the language line is the protocol — the part every pillar and every runtime
shares. This chapter teaches it in depth, and it is all real code: the braced
emq:{q}: keyspace that EchoMQ.Keyspace builds; the job
record hash and its field names; the atomic Lua scripts run by EVALSHA, every
key declared; and the immutability and branded-id discipline — the version fence, the 14-byte
branded id — that keeps the wire honest. Master this and the Queue, the Bus, and the Cache are three readings of
one substrate.
The wire in four parts
The protocol is four things, and the four modules of this chapter are each one of them. Pick a part to read what it is and the real surface that carries it — then take the module.
The protocol · pick a part
Four parts, one wire: the keys say where, the record says what, the scripts say how, and immutability says it will not change underneath a reader.
The modules
Four modules, each a hub and three dives, then a workshop. Each grounds in the real
echo/apps/echo_mq code — the keyspace builder, the job record, the Lua scripts, the
branded-id gate and version fence.
The owned keyspace
emq:{q}:<type> built by EchoMQ.Keyspace; the {q} hashtag and the slot it pins; the {emq}: reserve.
The record hash
The job HASH and its field names — state, attempts, payload — part of the protocol.
The Lua layer & EVALSHA
Every state change one atomic script; declared keys; load-once, run-by-SHA dispatch.
Immutability & branded ids
The immutable line, the 14-byte branded-id gate, and the version fence that guards the wire.
Workshop
Decode a real key, then trace one EVALSHA to its Lua source.
Redis Patterns Applied
This is the depth behind two Redis Patterns Applied chapters that door here:
R0.3 · Patterns become protocol (the idea that a
pattern, pushed below the language line, becomes a protocol) and
R2 · Coordination (hash-tag co-location and one-slot atomic Lua — the
{q} keyspace this chapter owns). There the pattern is the door; here is the wire.
Up next — the three pillars
With the protocol in hand, take the pillar you need. Each is a reading of this substrate: the Queue distributes work over it, the Bus broadcasts signals across it, the Cache serves reads in front of it.
The Queue
Distribute work: lifecycle, lanes, batches, controls, flows.
The Bus
Broadcast signals: events, the event log, consumer groups, time-travel.
The Cache
Serve reads: cache-aside, single-flight, coherence on the Bus.
Back to the Overview
The thesis, the three pillars, and the door.
The Protocol and the Queue are ready to read; the Bus, the Cache, and the Proof chapter are on the build front, each added as its pages land.
References
Sources
- Valkey — Documentation — the store the keyspace, the record, and the scripts run inside — the substrate of record.
- Valkey — HSET — the hash write the record is built from.
- Redis — EVALSHA — the load-once, run-by-SHA dispatch the Lua layer uses.
- DragonflyDB — Server flags — the thread-per-shard engine the declared-key, per-queue-hashtag keyspace is built for.
- llmstxt.org — The llms.txt convention — the machine-readable map format the course follows.
Related in this course
- Overview — the chapter that frames the system.
- The protocol below the line — the orientation dive this chapter deepens.
- redis-patterns R2 · Coordination — hash-tag co-location, the near side of the door.
- The Branded Component System — the architecture the wire belongs to.