Skip to main content
Cachingchapter 7 of 8 · 4 lessons

CDN (Content Delivery Network)

Cache static assets at edge servers close to users worldwide.

Every copy so far has lived in your infrastructure. Your users do not.

Someone in Pune loading an image from your servers in Virginia waits about 250 milliseconds for it to cross the planet, and no amount of caching in your own data centre recovers a single one of them. The distance is the cost. So put the copy near the user instead, in a network of servers you rent rather than run, which brings back every problem a cache has plus one more: this one is spread across hundreds of cities you do not control.

Lessons

4 in this chapter
  1. How a CDN WorksDNS steers each user to a nearby edge server, which serves from cache or fetches from your origin once.3 min
  2. Cache Keys and InvalidationThe cache key defines what counts as the same object, and versioned URLs beat purges.3 min
  3. Static vs Dynamic ContentAnything identical for all users belongs at the edge; everything else can still ride the CDN's rails.2 min
  4. Edge ComputeRunning code inside the PoP handles the personalization that pure caching cannot.3 min