Lesson 11 of 16
26. CDNs

Memory card and where the analogy breaks

3 min read+10 XP

The memory card (tear this page out)

#QuestionMemory code
26.1Why a CDN?Stock it near the shop, and the factory can rest
26.2Edge locations?A warehouse in every city; the road takes you to the nearest
26.3Pull vs push?Restock when asked, or ship before launch day
26.4Cache keys and headers?One label per product, and a use-by date on every carton
26.5Purging?Recall by product or by batch, but better to change the label than chase the cartons
26.6Origin shield?Warehouses call the depot; only the depot calls the factory
26.7Dynamic content?Cache the shared part for seconds, and do the small jobs near the customer
26.8Video segments?Cut the film into reels, in several qualities, and let the player pick reel by reel
26.9CDN failure?If the warehouses strike, have a second chain, and keep old stock you can still sell

The whole chapter in one line: Serve copies from a nearby edge, define "the same file" carefully, label freshness with Cache-Control, version instead of purging, shield the origin, cut video into segments, and plan for the CDN itself failing.

Where the analogy breaks

  • A biscuit carton is the same for every shop. Web responses can be personal, and a CDN that treats a personal page like a carton hands one user's data to another.
  • A recall reaches every warehouse but not the biscuits already in people's kitchens. A purge can't reach browsers' caches either, which is why browser TTLs need care.
  • Opening a new warehouse takes months. A CDN can route you to another city in milliseconds, which is why a CDN's mistakes also spread worldwide in seconds.

Quick check

Five questions on this chapter. Pick an answer, then check it.

quiz