Animation9 min

CDNs: Content at the Edge

Cutting latency by moving bytes closer to users.

No server tuning beats the speed of light. A request from New York to London takes at least ~80ms one way, no matter how fast your code is. A CDN (content delivery network) attacks the geography problem directly: it is a network of edge servers spread around the world that cache copies of your content close to users.

The animation opens with the problem: an origin server in Virginia, and a user in Tokyo whose request draws a long 150ms arc across the planet. Then the CDN switches on — edge nodes light up across the map, the file duplicates outward to each of them, and the same Tokyo request becomes a short 20ms hop to a nearby edge.

Two things to watch for. First, the very first request to an edge is a cache miss: the edge does not have the file yet, so it fetches from the origin (slow once), then serves everyone nearby from its local copy (fast forever after). Second, the trade-off: each edge copy can go stale if the original changes, so cached content carries a TTL (time to live — how long a copy is trusted before re-checking).

In interviews, any design with global users, images, or video should mention a CDN. It is a cheap, expected win.