Phase 1 — Clarify & Scope
Interviewer: Design a distributed cache — think Memcached at Facebook scale. What do you want to clarify?
Candidate: A few clarifying questions:
- What's the primary use case — database query caching, session storage, or computed result caching?
- What's the read/write ratio?
- What are the data types — simple key-value, or richer structures (lists, sets, sorted sets)?
- Do we need persistence, or is the cache purely ephemeral?
- What's the scale — requests per second, total data size?
Interviewer: Database query caching for a social network. Primarily reads (100:1 read-to-write ratio). Simple key-value only — values are serialized JSON objects. No persistence needed. Scale: 10 million requests/sec, 10 TB of cached data, 100 μs p99 latency SLA.
Candidate: Let me size this:
With 10 TB data and 64 GB RAM per cache node:
Per-node load:
Memcached handles 200K+ req/sec on modern hardware — we have ample headroom per node.
Interviewer: Good. What are the core requirements?
Candidate:
- Store and retrieve values by key (GET, SET, DELETE)
- Sub-millisecond reads under normal load, p99 < 100 μs
- Horizontal scaling — add nodes without downtime
- High availability — tolerate single node failure without serving stale data
In the full tutorial
- Phase 2 — High-Level Architecture
- Phase 3 — Deep Dive & Evolution
- Phase 4 — Robustness & Operations