jonnify·redis /redis-patterns

A jonnify course

Redis Patterns,
Applied.

The judgement layer above the command reference — thirty Redis design patterns, each shown working in a real system. Taught as problem → solution → trade-off → when-to-use, then shown where the BCS architecture applies it.

The running system: EchoMQ backed by Valkey, Valkey under the hood, EchoCache in front. The worked examples are real keys, commands, and atomic Lua scripts — quoted verbatim from committed records, not plausible ones.

cache queue stream
§1

How to read this

the running system: the BCS build

Each chapter teaches a family of Redis patterns. A pattern is a single unit: the problem it solves, the Valkey structures and commands that solve it, the trade-off it accepts, and the workload it fits. The claim of the course is that knowing the commands is not enough — the same engineer reaches for a single-node “distributed lock” a failover silently breaks, or a fixed-window rate limiter with a boundary burst. The fix is grounding: every pattern is shown applied in a real system, so the worked example is verifiable.

The running system is the BCS build. EchoMQ is the bus between systems, and it owns its protocol: the braced emq:{q}: keyspace, every Lua key declared or root-derived, the wire version echomq:2.0.0 behind a two-way typed boot fence — backed by Valkey, the current stable line, an enforced conformance gate. The atomic Lua scripts are the protocol: a corpus of Redis patterns made owned, declared code. EchoCache is the near-cache in front of it — branded keys, an L1 of ETS tables over the shared L2 Valkey, coherence by mint time. The worked consumer of both is the Exchange Platform — the trading system these patterns are applied inside (echo/apps/exchange); where a chapter’s deeper implementation belongs to the protocol itself, it doors forward to the dedicated EchoMQ course.

A scope note. The engine is Valkey — the current stable line, the substrate the EchoMQ connector is gated against. Where a pattern depends on a specific command, the lesson names it.

The grounding · pick a pattern family to read its real EchoMQ / EchoCache artifact
readout · Select a family. Every pattern points at a real artifact — a Valkey key, a command, or an atomic Lua move — that you can read and run.

No pattern is taught in the abstract. Each one points at a committed artifact — the braced emq:{q}: keyspace, the claim script, the four sorted sets, or an EchoCache figure — quoted verbatim from the record.

§2

The evidence ethic

committed outputs, quoted verbatim

Every claim in the course is backed by a committed record — a frozen transcript quoted verbatim. A number that is not in a committed output does not appear on a page. The EchoMQ connector — the production Valkey client at echo/apps/echo_wire — pipelines as its primitive:

EchoMQ.Connector · the production Valkey client (echo/apps/echo_wire) · figures content/bcsA.mdfrozen
fence claimed                 echomq:2.0.0   ← typed, fatal on mismatch
sequential INCR               29456 ops/s
pipelined SET                 454483 ops/s   ← fifteen times the sequential figure, same socket
pipelined EVALSHA             161192 ops/s   ← declared-keys law at speed
script_loads                  1              ← exactly one NOSCRIPT load
10000-command pipeline        returned 1..10000 in order
§3

The map

R1–R8 · sequenced along the EchoMQ build

The full course, chapter by chapter. The patterns are sequenced along the EchoMQ build — coordination, then queues, then time, streams, flow, and operations — so the catalog doubles as a guided build of the BCS Redis tier. The module that closes each chapter is its workshop.

live chapter front door built lesson ready planned drafted, on the way soon specified
R1

Caching

Open chapter →

The read path: serving reads fast and keeping the cache consistent on writes. → EchoCache

R2

Coordination & Consistency

Open chapter →

Atomicity first — the foundation every later chapter builds on. → EchoMQ

R3

Reliable Queues

Open chapter →

Wait, active, done, recover — the heart of EchoMQ, the densest grounding in the course. → EchoMQ

R4

Time, Delay & Priority

Open chapter →

The sorted set as a clock — a timer wheel and a priority ladder. → EchoMQ

R5

Streams & Events

soon

The durable log — observability and event-driven coordination. → EchoMQ

R5.01soon

Event sourcing on Streams

The append-only log is the source of truth; state is its replay.

R5.02soon

Stream consumer patterns

Block, batch, trim, resume; consumer groups.

R5.03soon

Pub/Sub vs Streams

Fire-and-forget vs durable, and how to choose.

R5.04soon

Custom events & projections

Domain events and windowed projections on one stream.

R5.05soon

Workshop

A live activity feed.

R6

Flow Control & Scale

soon

Staying stable under load — limiting, fairness, batching, concurrency. → EchoMQ

R6.01soon

Rate limiting

Fixed/sliding window and token/leaky bucket, enforced globally.

R6.02soon

Priorities & fairness

Starvation and how to avoid it.

R6.03soon

Groups & multi-tenant fairness

Round-robin fairness with a per-group semaphore.

R6.04soon

Batches & pipelining

One round-trip, all-or-nothing bulk enqueue.

R6.05soon

Worker concurrency

The fetch ceiling and how to plan capacity.

R6.06soon

Workshop

Rate-limit and fairly schedule the API and jobs.

R7

Data Modeling & Memory

soon

How data lives in RAM — the modeling family and the BCS read-models.

R7.01soon

Redis as a primary database

The store as the system of record, not a cache.

R7.02soon

Memory optimization

Compact encodings and short fields.

R7.03soon

Probabilistic data structures

Trade accuracy for memory — a contrast with exact dedup.

R7.04soon

Bitmaps

Millions of boolean flags in minimal memory.

R7.05soon

Vectors & similarity search

Native vector sets for semantic search.

R7.06soon

Geospatial

Locations and radius queries on a geohash sorted set.

R7.07soon

Workshop

The dashboard read-models.

R8

Production & Operations

soon

Running the tier at scale — case studies and operational discipline; the capstone. → EchoMQ

R8.01soon

Linux kernel tuning

Kernel settings that prevent latency spikes and persistence failures.

R8.02soon

Persistence, pooling & failover

Operating the store as a system of record in production.

R8.03soon

Pinterest: task queues & partitioning

Functional partitioning and list-based reliable queues at scale.

R8.04soon

Twitter/X: internals & custom structures

Customizations that became core.

R8.05soon

Uber: resilience & staggered sharding

Staggered sharding, circuit breakers, graceful degradation.

R8.06soon

Operating EchoMQ

Pooling, cluster co-location, metrics and tracing in production.

R8.07soon

Capstone — the door to EchoMQ

What the dedicated EchoMQ course teaches next.

A module card becomes a link when its pages ship. R1–R4 are built; R5–R8 are specified. The chapters are sequenced as the EchoMQ build, so the catalog doubles as a guided tour of the BCS Redis tier.

§4

The doors

the sibling courses
§5

References

sources · related

Sources

Related