CDN
Copies of a website kept on servers around the world, close to whoever asks.
A CDN (content delivery network) is a set of servers spread across many cities that keep copies of a website's files: images, videos, scripts, whole pages. When you open the site, your request goes to the nearest of those edge servers instead of travelling to the company's own server, the origin, which may be on another continent. Shorter distance means lower latency, and the page appears faster.
The edge works as a cache. If it already has the file you asked for, that is a cache hit and it answers on the spot. If not, a cache miss, it fetches the file from the origin once, keeps a copy, and serves it to everyone nearby who asks next. The site decides how long each copy may live: a logo can stay for a month, a news front page maybe for a minute.
Almost every big site uses one. A video service in Buenos Aires does not stream every episode from Virginia; it streams from a server a few kilometers away. The origin also gets far fewer requests, so it needs less capacity, and because a CDN has huge total bandwidth spread across the world, it can absorb traffic floods like a DDoS attack that would knock a single server over. Amazon CloudFront, Cloudflare, Akamai and Fastly are well-known CDNs.
Keep in mind
- Edge servers near users keep copies of files from the origin server.
- A cache hit is answered at the edge; a cache miss goes to the origin once.
- The site controls how long each file may stay cached.
- Besides speed, a CDN shields the origin from load and traffic floods.