Start Here

Tier 1 · Building Blocks

Scale Reads

Scale Writes

Database Selection

Traffic Control

Consistency & Coordination

Estimation

Tier 2 · Core Systems

Tier 3 · Location & Real-Time

Tier 4 · Infrastructure & Data

Tier 5 · Finance & Commerce

Tier 6 · Advanced & Collaborative

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:

  1. What's the primary use case — database query caching, session storage, or computed result caching?
  2. What's the read/write ratio?
  3. What are the data types — simple key-value, or richer structures (lists, sets, sorted sets)?
  4. Do we need persistence, or is the cache purely ephemeral?
  5. 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:

Read rate=10M req/sec×100101≈9.9M reads/sec\text{Read rate} = \frac{10\text{M req/sec} \times 100}{101} \approx 9.9\text{M reads/sec}

Write rate≈99,000 writes/sec\text{Write rate} \approx 99{,}000 \text{ writes/sec}

With 10 TB data and 64 GB RAM per cache node:

Cache nodes=10 TB64 GB≈156 nodes\text{Cache nodes} = \frac{10 \text{ TB}}{64 \text{ GB}} \approx 156 \text{ nodes}

Per-node load: 10M156≈64,102 req/sec per node\frac{10\text{M}}{156} \approx 64{,}102 \text{ req/sec per node}

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

Glossary history

Click dotted jargon to save explanations here.