All the basics

What is a CDN?

Keep copies of your images and pages in many cities, so each visitor gets them from somewhere close.

Shops spread around the world. You walk to the nearest one for your goods instead of travelling all the way to the factory.

Press Play to watch it run · 3 steps

Without a CDN every visitor reaches one faraway server. With one, a copy close to them answers.

One far server, or a copy nearbyWithout a CDN every visitor reaches one faraway server. With one, a copy close to them answers.VisitorNearby copyMain server

Tap any box to see what it is and what it talks to.

  • Client
  • CDN
  • Service
Open in playground
Text description
  1. A visitor in Sydney opens your page. Your only server is in Virginia.
  2. Each round trip takes about 200 ms, and a page needs many.
  3. Visitors from everywhere all reach that one server.
  • A CDN serves copies of your files from close to the visitor.
  • Closer means faster, and your main server gets less traffic.
  • Old copies linger, so you need a way to refresh them.

Reach for it when

When visitors are far away and the files rarely change, like Sydney to Virginia. Skip it if all visitors live nearby.

The catch

You replace the logo, but copies in other cities keep serving the old one until they expire or you purge them.

Say it in an interview“I would put static assets behind a CDN with long cache lifetimes and versioned file names. For urgent changes, I can purge the copy.”