Archprimer
ConceptBeginner 6 min read

CDN

A globally distributed network of edge servers that caches static content near users to cut latency and offload the origin, using origin pull and TTL-based freshness.

cachingedgelatencystatic-contentperformance

By Ratish Jain · Updated

Diagram with 4 components: User, Edge POP, Origin, Blob Store. Connections: User → Edge POP (1 · GET asset); Edge POP → Origin (2 · miss: pull); Origin → Blob Store (3 · fetch); Edge POP → User (4 · cached hit).
ClientCDNServiceStorage
User hits nearest edge; misses pull from origin and cache locally.

Definition

A Content Delivery Network (CDN) is a geographically distributed set of caching servers, called edge servers or POPs (points of presence), that store copies of static content close to users. Requests are served from the nearest edge instead of a distant origin.

Why It Exists

The speed of light and network hops make distant origins slow: a user in Tokyo hitting a server in Virginia pays hundreds of milliseconds per round trip. A CDN pushes content to the network edge so latency is governed by proximity, and it absorbs read traffic that would otherwise crush the origin and its bandwidth bill.

How It Works

DNS or anycast routing directs a user to the nearest POP. On a cache hit, the edge serves the file directly. On a miss, it does an origin pull: fetches the object from origin, returns it, and stores it locally for future requests. Each object has a TTL (via Cache-Control/Expires) after which the edge revalidates. Content is removed early through explicit purge/invalidation or cache-busting versioned URLs. CDNs increasingly cache dynamic and personalized content at the edge too.

What It's Used For

  • Serving images, CSS, JS, fonts, and downloads
  • Streaming video segments (HLS/DASH) close to viewers
  • Absorbing traffic spikes and DDoS at the edge
  • Reducing origin bandwidth and load
  • Edge TLS termination and compression

Tradeoffs

Pros
  • Dramatically lower latency via geographic proximity
  • Offloads read traffic and bandwidth from origin
  • Improves availability and absorbs spikes
  • Scales globally without you managing servers
Cons
  • Stale content risk until TTL expires or you purge
  • Invalidation across many POPs is slow and eventually consistent
  • Extra cost and a moving part in the stack
  • Poor fit for highly dynamic, per-user responses

When to Use / Avoid

Use when
You serve static or cacheable assets to a geographically spread audience and want low latency at scale.
Avoid when
Content is highly personalized/dynamic with no cacheable form, or your audience is single-region and small.
Real-world
Cloudflare, Akamai, and CloudFront serve most of the web; Netflix runs its own Open Connect CDN.

Interview Questions

How does a CDN keep cached content fresh?

Each object carries a TTL via cache headers; after it expires the edge revalidates with the origin. For immediate freshness you issue an explicit purge or use versioned/hashed URLs so a new URL bypasses the old cache.

What is the difference between origin pull and push?

With pull, the CDN fetches from origin lazily on the first miss and caches it. With push, you proactively upload content to the CDN ahead of demand — useful for large predictable assets.

60-Second Revision
  • →Edge POPs cache content near users to cut latency.
  • →Cache miss triggers an origin pull, then local caching.
  • →TTL controls freshness; purge/versioned URLs force updates.
  • →Offloads origin read traffic and bandwidth.
  • →Best for static/cacheable content, weak for per-user dynamic data.

Related

Everything on Archprimer is connected — follow the graph.