← Concepts
Networking·3 min read

CDN (Content Delivery Network)

Serve static and semi-static content from edge servers physically close to the user.

First time reading this? Start here

Plain English: copy your images and videos onto servers in cities all over the world, so a user in Tokyo doesn't wait for the file to come from your data center in Virginia. Closer = faster.

Used in:Instagram FeedNetflixTikTok
What it is

A global network of edge servers that cache content from your origin and serve it to nearby users. Same content, but served from milliseconds away instead of half a continent.

The problem it solves

The speed of light is slow when your users are 8,000 km from your origin. CDNs put a cached copy of your content within ~50ms of any user on the planet. They also offload large amounts of bandwidth from your origin, which cuts cost.

How it works

User requests an asset (image, video chunk, JS bundle). DNS routes them to the nearest CDN POP. If the POP has the asset cached, it serves immediately. If not, it fetches from origin, caches locally with a TTL, and serves. Subsequent requests in that region hit the cache.

Why use it
What it costs you
Where it shows up in our architectures
Gotchas
When this went wrong in production

Fastly takes down the internet · 2021

Postmortem ↗

A customer config trigger crashed Fastly globally: 49 minutes, half the modern web dark.

Fastly had pushed a config update weeks earlier that introduced a latent bug, only triggered by a specific customer configuration pattern. When that customer eventually applied their config, the bug fired across Fastly's global edge fleet within 12 seconds. Reddit, the NYT, Amazon, the UK Gov website: all 503ing simultaneously. Recovery took 49 minutes because the rollback procedure itself depended on healthy edge nodes. The lesson: latent bugs triggered by customer input are essentially production bombs. Canary deployments must rotate, and your incident-response paths must work even when your data plane is on fire.

Your notes

Private to you