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.
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
- Watch
- Try it
- Predict
- Capture
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.
Highlighted lines are the ones running in the diagram right now.
appendonly yesappendfsync everysec # ~1s loss on crashappendfsync always # zero-loss; fsync per writeappendfsync no # OS decides; seconds of losssave 3600 1 # RDB rule (hour, 1 change)save 300 100 # RDB rule (5m, 100 changes)no-appendfsync-on-rewrite noaof-use-rdb-preamble yes # multi-part AOF (7.0+)# stop-writes-on-bgsave-error yes
replicaof <MASTER> 6379 # only on replica nodesreplica-read-only yesmin-replicas-to-write 0 # default: async, best-effortmin-replicas-to-write 1 # refuse writes if <1 in syncmin-replicas-to-write 2 # refuse writes if <2 in syncmin-replicas-max-lag 10repl-backlog-size 64mb # PSYNC2 partial-resync windowrepl-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.
Designs that use this
- URL ShortenerShorten a long URL. Read-heavy. Don't collide.
- Distributed Rate LimiterEnforce a per-key request limit across a fleet of enforcers — accurately, in under a millisecond, without becoming the outage.
- Twitter / X TimelinePush or pull? Both. The canonical fanout problem.
- Uber / Lyft — Match Drivers and RidersMatch a rider to the closest acceptable driver in under 3 s. Geohash, S2, surge.