Design your Redis deployment

Every Redis deployment is a deliberate trade against the single-thread loop: persistence buys durability with throughput, Sentinel/Cluster buys availability with operator surface, and sharding buys parallelism with multi-key complexity — the right design names the trade out loud and pins it to the SLO.

Previously

You've seen every knob — single thread, encodings, persistence, eviction, TTL, replication, Sentinel, Cluster. Time to assemble them for a real workload, and watch the warning chips light up when your choices contradict each other.

Scene 09

Design your Redis deployment

  1. Watch
  2. Try it
  3. Predict
  4. Capture
Session cache · 50k QPS
User sessions, p99 < 1 ms, ok to lose ~1s of writes on crash. Cache, not source-of-truth — clients re-login.
LATENCYp99 < 1 msDURABILITY1s-loss okTHROUGHPUT50k QPS
DEPLOYMENTsingle · master + replicasmasterMASTERRDBAOF·1sreplica 1REPLICARDBAOF·1sKNOBSPERSISTENCERDB + AOF·1sREPLICATIONmaster + 1 replicaHAnoneSAFETYmrw: 0 (off)TRADE-OFFSThroughput2/5Durability3/5Complexity1/5WARNINGSConfiguration matches the SLO — knobs are honest about thetrade-off
What to watch for

Three workloads, three honest configurations. Watch the verifier nod (or refuse) as each SLO drops in and the knobs snap to the deployment that fits it. The captions name the trade — read each one.

Continue unlocks when the animation finishes.
Implementation

Highlighted lines are the ones running in the diagram right now.

redis.conf — persistence
fsync policy + RDB snapshot rule
appendonly yes
appendfsync everysec # ~1s loss on crash
appendfsync always # zero-loss; fsync per write
appendfsync no # OS decides; seconds of loss
save 3600 1 # RDB rule (hour, 1 change)
save 300 100 # RDB rule (5m, 100 changes)
no-appendfsync-on-rewrite no
aof-use-rdb-preamble yes # multi-part AOF (7.0+)
# stop-writes-on-bgsave-error yes
redis.conf — replication & safety
replica wiring + write-refusal floor
replicaof <MASTER> 6379 # only on replica nodes
replica-read-only yes
min-replicas-to-write 0 # default: async, best-effort
min-replicas-to-write 1 # refuse writes if <1 in sync
min-replicas-to-write 2 # refuse writes if <2 in sync
min-replicas-max-lag 10
repl-backlog-size 64mb # PSYNC2 partial-resync window
repl-diskless-sync yes
# masterauth <SECRET>

Where this sits in Build Redis

Scene 09 of 10, in the Shard & ship act — Cluster slots, MOVED/ASK, and the design canvas.. Capstone: pick persistence, HA, and sharding for a stated SLO; the verifier traces each choice back to the scene that taught it.

All 10 scenes in Build Redis · Every curriculum

Built with Arqly
Every scene in Build Redis builds on the one before it.All 10 Build Redis scenes