HardExperience level: 8-15 years1 min read

How would you design a distributed cache like Redis Cluster?

Reviewed by Gurusankar M.

Asked inAmazonGoogleMicrosoft
#distributed cache#redis#consistent hashing#replication#eviction
Report issue

Short Answer

Partition keys across nodes with consistent hashing, replicate each shard (primary + replicas) for availability with automatic failover, and evict via LRU/LFU under memory pressure with TTLs. Handle hot keys (replication/local cache), cache stampedes (single-flight), and decide the consistency model (usually eventual).

On this page

Concept Made Simple

Coffee Chat Question

β€œHow would you design a distributed cache like Redis Cluster?”

Remember It Faster

Mind Map Answer

Partition
consistent hashing across nodes
Replicate
primary + replicas, auto-failover
Evict
LRU/LFU + TTL under pressure
Handle
hot keys, stampedes, consistency

Think Beyond the Expected

What If?

One key is so hot it overloads its shard's node β€” how do you handle it?

Replicate that hot key to multiple nodes and read from any (or add a small local/client-side cache in front), and use single-flight to prevent stampedes. Consistent hashing spreads keys, but a single super-hot key still needs replication or client-side caching to spread the read load.

Real World

Redis Cluster/Memcached designs combine consistent hashing, replication + failover, and eviction; the hard parts in interviews are hot keys, stampedes, and the consistency/availability trade-off.

Interviewer's Expectation

Keywords they're listening for:

  • consistent hashing partitioning
  • replication + failover
  • LRU/LFU + TTL eviction
  • hot-key handling
  • stampede prevention
  • consistency model

Common Mistakes

  • No hot-key strategy
  • No replication (cache node failure = thundering herd)
  • Ignoring eviction policy tuning

Best Practices

  • Consistent hashing + replication + failover
  • TTL + LRU/LFU; single-flight loads
  • Replicate/local-cache hot keys

Follow-up Questions

  1. How does failover pick a new primary?
  2. LRU vs LFU eviction β€” when each?
  3. How do you keep the cache consistent with the DB?

Continue Learning with AI

Take this question deeper with your favourite AI assistant. Pick a depth, copy the prompt, or open it directly β€” AI is your learning companion, not a shortcut.

Plain-language foundations

I'm preparing for a software engineering interview and want to understand this from scratch, as a beginner.

Topic: Caching (System Design)
Interview question: "How would you design a distributed cache like Redis Cluster?"

Please:
1. Explain the core idea in simple, plain language, using an everyday analogy.
2. Define any technical terms you use.
3. Walk through one small, concrete example.
4. Finish with a single sentence I can easily remember.

Keep the tone friendly and assume I'm new to this topic.

Was this answer helpful?

Affiliate links

Equipment for a comfortable, productive setup.

As an Amazon Associate I earn from qualifying purchases.