Skip to content
StackDecode
System Design
2. Networking FundamentalsAnimated

Content Delivery Networks (CDN)

Servers around the world that serve content near users.

The idea

A CDN caches static files at edge locations so users get them from a nearby server instead of the origin.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

UserCDN edgeOriginGET /video.mp4
  • current message
  • earlier
  • failure or attack

The user is routed to the nearest edge location.

step:
1/6
from:
User
to:
CDN edge
1/6

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1User requests a file
  2. 2Nearest edge checks its cache
  3. 3On a miss it fetches from the origin and stores it
  4. 4Later users get a fast hit

Where it is used

Images, scripts, video, downloads.

Watch out for

Stale content: set cache headers and know how to purge.

Related