Highlights

Contents

SYSTEM DESIGN / UNIT 14 / FIELD GUIDECDN and contentdeliveryCDN and content deliveryA request has somewhere to goRoutes, serving sites and the source of truthRead the mechanism. Follow its state.Test what happens when the path breaks.MECHANISMS, TRACES AND INTERVIEW PRACTICE
Before we start

How to read this chapter

Edge locations, origins, hits, freshness, invalidation, pull and push placement, signed access, and geographic content delivery through Heron. Trace a private playback request and explain its identity, freshness, permission, origin load, and cold-failure behavior.

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 arithmetic lives in scripts/system-design/numbers.py and scripts/system-design/cdn-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 video example is an explicitly illustrative extension: one 4,000,000-bit-per-second rendition, 6-second segments, and an even audience across 100 edges. It is separate from the shared 200-byte live-score event workload. Hit fractions, cache ages, variant counts, and link latencies are teaching assumptions retained in the chapter ledger.

The map

What is inside

Trace a private playback request and explain its identity, freshness, permission, origin load, and cold-failure behavior.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1Edges, origins, hits andmisses2TTL and Cache-Control3Invalidation andversioned URLs4Pull vs push CDN andshielding5Signed URLs and privatedelivery6Geographic routing7Video and image delivery8Case study: private videodelivery
  1. 01Edges, origins, hits and missesSections 1 to 4. We move reusable content closer to readers while keeping its authoritative source explicit.
  2. 02TTL and Cache-ControlSections 5 to 8. We decide when a retained response may be reused without contacting its source.
  3. 03Invalidation and versioned URLsSections 9 to 12. We change what readers receive without assuming every edge updates at one instant.
  4. 04Pull vs push CDN and shieldingSections 13 to 16. We decide how content reaches a cache and how many simultaneous misses the source can absorb.
  5. 05Signed URLs and private deliverySections 17 to 20. We keep reusable private bytes behind a per-request permission boundary.
  6. 06Geographic routingSections 21 to 24. We select a serving site through network and service policy rather than assuming the closest dot on a map always wins.
  7. 07Video and image deliverySections 25 to 28. We apply the cache mechanisms to images, segments, and score-related traffic without mixing their units.
  8. 08Case study: private video deliverySections 29 to 32. We combine verified storage, access, routing, freshness, and source protection into one request.
  9. +Interview prepInterview question bank, graded exercises and worked solutions.