Index/CDN

SponsorGitHub
Key technologyEdge cache3 min

CDN

Caches near the user that cut latency, absorb read spikes, and shift most traffic off your origin.

At a glance

Shape
Caching proxies in points of presence, reached by anycast
Latency
A few ms from the edge; a cross-continent round trip is ~150 ms
Origin load
Cut by the hit ratio — 95% means one request in twenty reaches you
Cache key
Host + path + the query parameters and headers you choose
Invalidation
Versioned URLs, short TTLs; purge only for mistakes
Also does
TLS termination, HTTP/3, DDoS absorption, WAF, signed URLs

Key concepts and capabilities

The short listwhat it gives you
Distance is latency — a cross-continent round trip costs 150 ms no matter how fast your servers are
The cache key decides everything — key on a per-user tracking parameter and you cache nothing
Cache-Control is the contractmax-age, s-maxage for shared caches, stale-while-revalidate, private
Versioned URLs beat purgingapp.a81f3c.js cached for a year, replaced rather than invalidated
Origin shield — one mid-tier cache all edges fetch through, so a viral object causes one origin fetch
Dynamic content caches too — 5–30 seconds on a shared response is an enormous cut at a million requests a minute
Video is just segments — HLS and DASH files are static, which is why the CDN is the delivery mechanism
Personalisation kills sharing — split the page into a cached shell and a personalised fragment
It is also the security edge — TLS, DDoS absorption, WAF and signed URLs for private media

Use cases

Static assets, cached for a year

Versioned filenames make invalidation a non-problem: the URL changes when the content does, so the edge can hold the old one forever and no purge has to propagate. This is the uncontroversial case, and it takes one sentence in an interview.

FocusClick a node for details

Absorbing a read spike

A ticket on-sale or a viral post is a hundred thousand readers wanting the same bytes. Cached at the edge for even ten seconds, the origin sees one request per PoP per window instead of the flood — which is a capacity argument, not a polish one.

DatabaseFocusClick a node for details

Delivering video

HLS and DASH cut a stream into a manifest plus a few seconds of video per file. Those segment files are static and immutable, so they cache perfectly — the CDN is not an optimisation here, it is how the video reaches anyone.

Object storageFocusClick a node for details

Caching a page that is partly personal

If every response embeds the viewer's name, nothing is shared and nothing caches. Split it: the shell is one cached object for everyone, and the personal fragment is a separate, uncached call the client makes after paint.

FocusClick a node for details