In this module — 8 sections
11 — System design: the short sheet
The ten-minute version, for the night before. The full treatment is in
11b-system-design-completo.md— 52 pages, and where you should actually study from.
What is being measured
Not knowing technology names. Navigating ambiguity and defending trade-offs. A candidate who says "I'll use Kafka, Redis and Cassandra" without justifying it scores a 2. One who says "I'll use a simple cache because 95% of traffic reads the same thousand items, and I'll accept 60 seconds of staleness because the product tolerates it" scores a 4 — with a simpler architecture.
The question arrives deliberately vague. The vagueness is the test. Whoever starts drawing fails.
The 60 minutes
| Min | Phase | Deliverable |
|---|---|---|
| 0–8 | Functional requirements | a closed scope, with the non-goals said out loud |
| 8–13 | Non-functional plus scale | numbers: QPS, latency, storage, read vs write |
| 13–18 | API and data model | concrete endpoints; SQL vs NoSQL justified |
| 18–35 | High-level design | a diagram plus one request traced end to end |
| 35–50 | Deep dive | one or two components in depth — where senior separates from mid |
| 50–60 | Bottlenecks and trade-offs | what breaks at 10×, what you would sacrifice |
Announce the phases at minute three. That alone signals seniority: you are driving.
The arithmetic to have memorised
1 day = 86,400 s ≈ 10⁵ s
1M DAU × 10 actions → 10⁷ req/day → ~120 QPS average, ~350 at peak
peak = 2–3× average
1 KB × 1M/day = 1 GB/day ≈ 365 GB/year
cores = QPS × CPU-seconds per request, then divide by 0.6 utilisation
| Operation | Time |
|---|---|
| L1 cache | ~1 ns |
| RAM | ~100 ns |
| SSD random read | ~15–150 µs |
| Round trip in the same datacenter | ~0.5 ms |
| Disk seek | ~10 ms |
| LLM token | ~20 ms |
| Round trip across continents | ~150 ms |
| SLO | Downtime per month |
|---|---|
| 99% | 7.3 h |
| 99.9% | 43.8 min |
| 99.99% | 4.4 min |
Availability in series multiplies: three components at 99.9% give 99.7%. Utilisation above 80% makes queueing delay grow non-linearly — size for 60%.
The building blocks, in one line each
- Load balancer — L4 is fast and dumb, L7 routes on path and headers. Least-connections beats round-robin; consistent hashing keeps a key on one server.
- Cache — cache-aside is the default. Watch for stampede (per-key regeneration lock, TTL with jitter), penetration (cache the negative), and hot keys. Below ~80% hit rate it is not paying.
- CDN — solves the 150 ms. Put the locale in the cache key.
- Sharding — hash distributes but kills range queries; range enables scans but creates hot spots. Consistent hashing with virtual nodes remaps 1/N instead of everything.
- Replication — sync is consistent and slow; async is fast and loses the tail on failover, and the lag is visible to the user.
- Queue — decouples, absorbs peaks, enables retries. At-least-once ⇒ idempotent handlers. Alert on the age of the oldest message, not the depth.
- Inverted index — sharded by document, not by term. Two-phase ranking: retrieve cheap, re-rank expensive.
- Rate limiting — token bucket. Distributed: local quotas synced every second beat a central Redis on the hot path, if you can accept approximation.
- Idempotency — every exposed write needs a key. One of the strongest seniority signals there is.
CAP, said correctly
Partitions happen; they are not a choice. During one, you either serve possibly-stale data (AP) or refuse to answer (CP). PACELC adds the half that matters daily: even with no failure, consistency costs latency.
Never recite it. Apply it, with the effect the user observes.
Production — where the senior score is decided
- Cascading failure: slow service → clients accumulate in-flight requests → threads exhaust → their clients stall. Restarting does not fix it. Defences: deadline propagation, bounded queues, load shedding by criticality, retry budgets.
- Retries: at most 3 per request, at most 10% of traffic per client, exponential backoff with jitter, and only at one layer of the stack.
- Graceful degradation: name the degraded behaviour of every dependency. A worse answer, delivered, usually beats an error.
- Rollout: feature flag → canary with a pre-agreed abort criterion → progressive by failure domain. Shadow traffic to validate without risk.
- SLI, SLO, error budget: the budget turns "how reliable?" into a decision with a number.
The five traps
- Drawing before asking.
- Estimating and then not using the number.
- Components with no justification sentence.
- Staying on the surface — the deep dive is the score.
- Never mentioning failure, cost, or what you would cut from v1.
Before you close
Sixty free seconds that most candidates skip:
"To summarise: the design is X. The main trade-off I made was A over B, because C. The first thing that breaks at ten times the scale is D, and I'd fix it with E. If I were shipping a v1 next month, I'd cut F and G."