Content delivery network
A content delivery network works by caching your files at edge locations worldwide and routing each user to the nearest one, usually via anycast DNS. The edge serves cached copies directly; on a cache miss it fetches from your origin once, stores the result, then serves every later request locally.
The routing layer is what makes a CDN feel instant. With anycast, the same IP address is announced from many locations, and the network naturally routes a user to the topologically closest edge node — no per-user logic required. That node (a point of presence, or PoP) is where caching happens.
On a request, the edge checks its cache. A hit is served immediately from local SSD or memory. A miss triggers a single fetch from your origin; the response is cached according to its headers, and every subsequent request for that asset is served from the edge until it expires or is purged. This is the cache hit ratio you want to maximize.
Freshness is governed by Cache-Control (how long the edge may serve a copy) and revalidation via ETag or Last-Modified (cheap 304 responses when nothing changed). Tuning these headers is the difference between a CDN that offloads 99% of traffic and one that constantly hammers your origin.