failover
← All labs

Medium · 11 steps · ~55 min

Design a CDN

Serve the world from the edge and keep the origin calm.

A site serves images, scripts and video to users all over the world. The origin is in one region and slow for distant users, and it cannot handle viral traffic. Build a content delivery network that serves most requests from nearby caches and protects the origin.

Same problem as CloudflareAkamaiFastly

How it works

What you'll build

  1. The API and cache entry data
  2. A CDN in front of the origin
  3. A shield tier that merges edge misses
  4. Geo-routing capacity across the globe
  5. Designs that survive a cold cache, a lost edge and a lost origin server

Steps

  1. 1Design the API
  2. 2Design the data model
  3. 3Serve the first customers from the origin
  4. 4Take the load off the origin
  5. 5Fresh content and purge
  6. 6Add a second tier: the origin shield
  7. 7Go global: a million requests a second
  8. 8Survive a cold cache on the origin
  9. 9Lose a point of presence
  10. 10Lose an origin server
  11. 11Deep dive: the stampede
Start the lab →