CONCEPT SHEET · Concepts

CDN (Content Delivery Network)

One-liner: Globally distributed edge caches that serve static (and some dynamic) content near users, cutting latency and origin load.

ArticleConcepts© Arthur Bernier Jr517 words1 code block

Say this#

How it works#

TEXT
user -> DNS (geo/anycast) -> nearest edge PoP --hit--> response                                   |--miss--> origin shield --miss--> origin (S3 / app)
  1. DNS or anycast routes the user to the nearest PoP.
  2. Edge checks its cache by cache key; hit returns in single-digit ms.
  3. Miss goes to shield, then origin; response cached per Cache-Control.
  4. Deploys ship new fingerprinted asset names; HTML stays short-TTL or no-store.
  5. Dynamic content: CDN still terminates TLS near the user and keeps warm connections to origin (reduces TCP/TLS handshake RTTs); can run edge compute (Cloudflare Workers, Lambda@Edge).

Trade-offs#

ChoiceProCon
Pull CDNZero upload step, caches only what's requestedFirst request per PoP is a miss
Push CDNAlways warm, predictableMust manage uploads/expiry; wasted space
Long TTL + fingerprintingNear-100% hit ratio, no purgesRequires build pipeline discipline
Short TTL on HTMLFast rolloutsMore origin traffic
Caching personalized responsesPossible with Vary/edge logicEasy to leak one user's data to another; usually don't

Numbers#

  • Edge hit latency: ~1-10 ms vs ~50-150 ms cross-continent to origin.
  • Static asset hit ratios of 90-99% are typical when fingerprinted.
  • Cloudflare and Akamai each operate PoPs in 300+ cities; CloudFront 600+ PoPs (order of magnitude: hundreds).
  • Purge propagation: seconds to minutes; CloudFront invalidations are billed beyond a free monthly quota.

In the interview#

See also