How to read this chapter
DNS, transports, HTTP, encryption, proxies, connection reuse, deadlines, retries, and live delivery, explained through one score request. Draw the complete request path and explain what each boundary guarantees.
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 shared arithmetic lives in scripts/system-design/numbers.py and this chapter’s message, timing, and recovery traces live in scripts/system-design/networking-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.
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 | 8,640,000 | Baseline request demand | |
| Peak multiplier | 10 | Peak relative to daily average | |
| Mean response time at peak | 0.2 s | Mean in-flight work | |
| API response size | 2,000 bytes | Payload bandwidth | |
| Stored record size | 500 bytes | An illustrative write workload | |
| Record retention | 30 days | Storage calculation | |
| Live events | 20 per second | Fan-out input | |
| Live viewers | 50,000 | Fan-out recipients | |
| Event payload | 200 bytes | Live payload bandwidth | |
| Gateway capacity assumption | 10,000 connections | A sizing exercise, not a benchmark | |
| Replication factor | 3 | Copies of a logical record | |
| Rate policy | 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.
What is inside
Draw the complete request path and explain what each boundary guarantees.
- 01DNS, TCP and UDPSections 1 to 6. We follow a score request to the server that owns it.
- 02HTTP versions and TLSSections 7 to 12. We carry an application request across the connection.
- 03REST, gRPC, WebSockets and SSESections 13 to 16. We choose how the application expresses work.
- 04Proxies, L4/L7 and connection poolsSections 17 to 20. We put a deliberate entry point in front of the service.
- 05Timeouts, retries and backoffSections 21 to 25. We stop a failed call from consuming unlimited time.
- 06Idempotency, polling and pushSections 26 to 29. We give repeated messages a predictable meaning.
- 07Case study: one request end to endSections 30 to 32. We assemble the path and explain every boundary.
- +Interview prepInterview question bank, graded exercises and worked solutions.