What is a CDN, what problems does it solve, and what can it not help with?
Key points
- Geographically distributed edge caches that serve content close to users to cut latency and origin loadIn plain words: Copies of your content sit in many cities, so users get it from nearby and your own servers do less
- Clients reach the nearest edge via DNS or anycast routingIn plain words: The network steers each user to the closest copy automatically
- Caches static assets well, dynamic or personalised responses only with care (short TTL, cache keys, edge compute)In plain words: Files that are the same for everyone cache easily, while pages that differ per person need careful handling
- Also absorbs traffic spikes and DDoS and terminates TLS near the userIn plain words: It also soaks up sudden crowds and attacks, and sets up the secure connection close to the user
- Cannot fix origin write latency or data that must be fresh per requestIn plain words: It cannot speed up saving data, or anything that must be freshly computed for each request
Model answer
A content delivery network is a fleet of caching servers (points of presence, or PoPs) placed in many cities. A user's request is routed to the nearest PoP; if that PoP has the object it responds in a few milliseconds, otherwise it fetches from your origin, stores a copy and returns it.
Problems it solves
- Latency. Speed of light is the hard limit; a round trip from Sydney to Virginia is ~200 ms. Serving from Sydney makes it ~10 ms.
- Origin load. A popular object is fetched from origin once per PoP, not once per user.
- Burst absorption. Launch-day spikes and volumetric DDoS hit the edge, which has far more capacity than your servers.
- TLS and connection reuse. The edge terminates TLS close to the user and keeps warm connections to origin.
What it caches well: images, video segments, JS/CSS bundles with hashed names, public API responses with short TTLs, whole HTML pages for anonymous users.
What it does not fix: writes still travel to origin; personalised responses need either a cache key that includes the user (low hit rate) or edge compute that assembles pages from cached fragments; and data that must be fresh on every read gains nothing except TLS termination.
A good answer names the routing mechanism, the cache key, TTL and invalidation, and origin shielding to collapse misses from many PoPs into one.
Likely follow-ups
- How does a cache key differ from a URL, and why does it matter for CDN hit rate?
- What is origin shielding?