Skip to content
BytePatterns

Content Delivery Networks

System Design: lesson 6 of 17

Distance is latency you cannot optimise away.

Lesson 6 of 17 · 5 min

Content Delivery Networks

Step 1 of 11

Distance is latency you cannot tune away. A CDN keeps copies near the visitor.

The Idea

A CDN keeps copies of your static files on servers spread across the world and routes each visitor to a nearby one. Bytes then travel hundreds of kilometres instead of crossing an ocean, which no amount of server tuning can fix. Your origin only ever sees the misses.

Real-World Example

A machine-tool maker stocks common spares in regional depots. A snapped drive belt is replaced the same afternoon instead of waiting on a shipment from the factory. Rare parts still come from the central warehouse, and nobody pretends every depot can hold one of everything.

The Tradeoff

The edge holds copies, so a bad deploy is now cached in fifty places and a purge has to reach every one of them — from under a second to several minutes, depending on the provider. Versioned filenames dodge that entirely. Content that is personal or differs per request has nothing to reuse; mark it private and let it skip the edge.

Your turn

Put the steps in the right order.

  1. The edge stores the file under its cache rules and serves it
  2. The visitor's request is routed to the nearest edge location
  3. Later visitors nearby are served without the origin being touched
  4. On a miss, the edge fetches the file once from the origin

Mini quiz

1 / 3

A CDN mainly reduces:

New lessons land every few weeks

Leave an address and we will tell you when the next one is up. That is the only reason we will use it.

One address, stored so we can email you. Nothing else, ever.