CDN
see-dee-en
Content delivery network: a global network of servers that caches and serves content from locations close to users.
A CDN (content delivery network) is a distributed network of servers that caches content at locations close to users. Instead of every request traveling to your origin server in Virginia, the CDN serves the content from a server in the user's city. A user in Tokyo gets your image from a Tokyo server in 20ms instead of a Virginia server in 200ms.
CDNs started by caching static assets: images, CSS, JavaScript, fonts. Modern CDNs do much more. Cloudflare, Fastly, and AWS CloudFront can cache API responses, run serverless functions at the edge, handle DDoS protection, and terminate SSL. Vercel and Netlify are essentially CDN-first platforms that deploy your entire application to the edge.
The economics of CDNs favor scale. Bandwidth from a CDN costs a fraction of bandwidth from your origin server. CDN providers negotiate bulk rates with ISPs and peer directly at internet exchange points. For a content-heavy site, a CDN can reduce origin bandwidth costs by 90% or more while simultaneously improving performance for every user on the planet.
Examples
A SaaS company deploys a CDN for their marketing site.
The marketing site loads 2.5MB of images, CSS, and JavaScript. Without a CDN, users in Australia wait 4 seconds for the page. With Cloudflare's CDN, assets are cached at 300+ edge locations. Australian users load the page in 800ms. The origin server handles only the initial cache population, not ongoing traffic.
A video streaming platform uses a CDN to handle traffic spikes.
A live event draws 2 million concurrent viewers. The origin server cannot handle that traffic alone. The CDN caches the video stream at edge locations worldwide. Each edge server handles viewers in its region. The origin server sends one copy of the stream to the CDN. The CDN multiplies it to 2 million viewers. Origin bandwidth stays flat.
A developer configures CDN caching rules.
Static assets (images, fonts) get a 1-year cache with content hashes in filenames for cache busting. HTML pages get a 5-minute cache with stale-while-revalidate, so users see fast responses while the CDN refreshes in the background. API responses are not cached at the CDN because they contain user-specific data.
In practice
Read more on the blog
Frequently asked questions
Do I need a CDN if my users are all in one country?
Yes, usually. A CDN still helps even for a single-country audience. It reduces latency by serving from the nearest city instead of one data center. It absorbs traffic spikes so your origin server does not fall over. It provides DDoS protection. And CDN bandwidth is cheaper than origin bandwidth. The performance and cost benefits apply regardless of geographic distribution.
What is the difference between a CDN and a load balancer?
A load balancer distributes traffic across your own servers in one or a few data centers. A CDN caches content across hundreds of locations worldwide and serves it from the location closest to the user. They solve different problems. A load balancer handles scale at your origin. A CDN reduces the traffic that ever reaches your origin. Most production architectures use both.
Related terms
Storing a copy of data in a faster location so repeated requests do not hit the slower original source.
Distributing incoming network traffic across multiple servers so no single server becomes a bottleneck.
Adding more servers to handle increased load, instead of upgrading existing servers.
The percentage of time a system is operational and accessible to users.
Restricting how many requests a client can make to an API within a time window to prevent abuse and overload.

Want the complete playbook?
Picks and Shovels is the definitive guide to developer marketing. Amazon #1 bestseller with practical strategies from 30 years of marketing to developers.