SteelReed

Search

Search posts, questions…

System DesignQuestion 7 / 26

Junior

What is a CDN, how does it work, and what does it do for a system?

Short answer

A CDN is a network of edge servers around the world that keeps copies of content close to users instead of sending every request to the origin. Benefits: faster loads, less load on the origin, and a DDoS/WAF shield at the edge.

hitmissstore per Cache-ControlUserNearest edgehas a copy?Served from edgeFetch from origin

3 points to say:

  1. A hit is served straight from the edge; a miss goes to the origin and is stored per Cache-Control.
  2. Files with a hash in the name: cache for a year (immutable); HTML and public pages: short TTL or purge.
  3. Never let the CDN keep personal responses (private/no-store); a full purge still dumps traffic on the origin.

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.