Components · Traffic and compute

CDN

Serves cacheable reads at the edge; storage, TTL and popularity decide the hit rate.

Lesson
Coming soon
Zone
edge
Place it
4 cr on the blank canvas, free inside a problem

At a glance

Did you know
A CDN keeps copies at edge locations near users, so a cache hit skips the trip to your origin.
Rule of thumb
Purge by path or tag. Purging everything sends every request to the origin at once.
Watch out
Miss storms after a purge can overload the origin.

Problems that start with it

  • YouTube end to end 20,000 requests/s routed by path: watch, search, comments and uploads. Metadata cache in front of Vitess MySQL, recommendations, view events into Kafka, uploads to storage and a transcoding queue.
  • Breaking news A news article goes viral: traffic ramps to 4× over the run. Pages are cacheable at the edge, but the CDN is tiny.
  • Breaking news on a tiny CDN A story goes viral: traffic ramps to 4×. The CDN has 256 MB of edge storage for half a million pages, and the origin API renders pages at 6 ms of CPU each on 2 vCPUs per replica.
  • Instagram Stories: views reach the origin Stories are photos and short videos viewed millions of times, then they expire. The CDN is too small, so most views go back to the origin.
  • Netflix: a new season at midnight A new season drops: traffic jumps 4× at 10 s for 15 seconds. The CDN is undersized, so the origin sees a large share of the spike.
  • CDN purge at peak At 12 s a deploy purges the whole CDN while 2,500 requests a second are flowing. Every request now goes to an origin sized for the usual few misses.

Full lesson coming soon

Lessons are being added one component at a time: how it works, its settings, a live exercise to break and fix it, interview questions and a short check. See the Circuit breaker lesson for what one looks like.