Back to roadmap
Module 8 · Caching, Queues, Async WorkDay 07325 min

Distributed Caches

Redis and Memcached at scale.

Day 073

Distributed Caches

Slot 0–5460
datastore
Slot 5461–10922
datastore
Slot 10923–16383
datastore
Memory hook

Distributed Caches: redis and memcached at scale

Mental model

absorb bursts before they become outages

Design lens

Multi-key ops constrained to a slot.

Recall anchors
RedisMemcached

Why it matters

Distributed caches add capacity by sharding keys across nodes. Redis Cluster ships with consistent-hashing slots and replication; Memcached is simpler but lacks persistence and replication.

Deep dive

Redis Cluster: 16384 hash slots; clients route by slot.

Replication for failover; persistence (RDB, AOF) for restart.

Memcached scales by adding nodes; clients consistent-hash.

Demo / scenario

Move single Redis to a cluster.

  1. Plan slot map across 6 nodes (3 primary + 3 replica).
  2. Migrate keys; clients tolerate MOVED redirects.
  3. Failover takes seconds with sentinel/cluster.

Tradeoffs

  • Multi-key ops constrained to a slot.
  • Pipelines + Lua scripts must respect slot boundaries.
  • Operational complexity rises with cluster mode.

Diagram

Slot 0–5460
Slot 5461–10922
Slot 10923–16383
Sharded Redis cluster.

Mind map

Check yourself

Loading quiz…

Sources & further reading