Highlights

Contents

SYSTEM DESIGN / UNIT 2 / FIELD GUIDEPerformance andcapacityPerformance and capacity estimation1,000 requests/s at match startadmission200/300200/300200/300200/300200/300database5 × 300 = 1,500 req/sbacklogarrivals − service, every secondp99 waits at the tailname the unitbeside every numberCOUNT THE WORK. NAME THE BOTTLENECK.
Before we start

How to read this chapter

Latency, tail distributions, bandwidth, IOPS, concurrency, queueing, bottlenecks, scaling, and overload with computed capacity budgets. Explain which resource limits a design and show how it behaves during a burst or a server failure.

Read each small topic as a separate whiteboard explanation. Start with the concrete failure, follow the mechanism, and check the worked example before looking at the picture. A paragraph introduces one idea; the next picture shows the state or message that changes. You should be able to redraw it and say where it can fail.

The orange map marks the part you are reading. Picture this boxes give a physical analogy, notes explain a useful variant, warnings name a mistake, and interview boxes give an answer you can say aloud. Each part closes with In one breath. The interview page has questions, graded exercises, and worked answers; use it after reading, with the diagrams hidden.

These are design lessons, not measured capacity claims. All Heron workloads, durations, limits, and record sizes are illustrative assumptions. The chapter arithmetic lives in scripts/system-design/capacity-review-numbers.py; real product behavior is linked to its primary documentation. A decimal MB is a million bytes; a GiB is a power-of-two unit. Capacity still needs a load test on your workload.

The running system

Meet Heron

Heron is an illustrative live-score and media service. A scorer changes a match, viewers read its score, subscribers receive updates, and users upload clips. We keep the workload fixed across the series so a faster path, a replica, or a cache changes the same calculation instead of quietly changing the question.

Assumed setting Symbol Value What it controls
Daily API requests DD 8,640,000 Baseline request demand
Peak multiplier pp 10 Peak relative to daily average
Mean response time at peak WW 0.2 s Mean in-flight work
API response size bb 2,000 bytes Payload bandwidth
Stored record size rr 500 bytes An illustrative write workload
Record retention tt 30 days Storage calculation
Live events ee 20 per second Fan-out input
Live viewers vv 50,000 Fan-out recipients
Event payload mm 200 bytes Live payload bandwidth
Gateway capacity assumption gg 10,000 connections A sizing exercise, not a benchmark
Replication factor NN 3 Copies of a logical record
Rate policy LL 100 requests per user per minute Admission rule

The computed baseline is 100 requests per second on average and 1,000 at peak. At the assumed mean latency, 200 requests are in flight. Live fan-out is 1,000,000 deliveries per second, carrying 200,000,000 payload bytes per second before protocol overhead. These are different workloads; never size the live path using the API request rate.

The map

What is inside

Explain which resource limits a design and show how it behaves during a burst or a server failure.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1Latency, throughput andLittle's law2p50, p95 and p99 latency3IOPS, bandwidth andstorage4CPU-bound, I/O-bound andbottlenecks5Scaling and Amdahl's law6Queueing and backpressure7Case study: capacityestimation
  1. 01Latency, throughput and Little's lawSections 1 to 5. We count arriving work, completed work, and the time spent between them.
  2. 02p50, p95 and p99 latencySections 6 to 10. We inspect the viewers hidden by an average.
  3. 03IOPS, bandwidth and storageSections 11 to 15. We count the resources carrying each operation.
  4. 04CPU-bound, I/O-bound and bottlenecksSections 16 to 20. We locate the stage that prevents useful completions.
  5. 05Scaling and Amdahl's lawSections 21 to 25. We ask which work can run independently.
  6. 06Queueing and backpressureSections 26 to 30. We make overload visible and bounded.
  7. 07Case study: capacity estimationSections 31 to 35. We turn resource arithmetic into a design claim someone can review.
  8. +Interview prepInterview question bank, graded exercises and worked solutions.