What a CDN does, and when you need one
What a content delivery network actually does, and the honest answer to whether your site needs one.
A content delivery network solves one specific problem: distance. Every extra mile of physical and network distance between your server and a visitor adds delay before anything can even start loading, no matter how fast your server itself is. A CDN puts copies of your site's static files on servers spread around the world, so a visitor in another country fetches those files from somewhere near them instead of travelling all the way back to wherever your hosting account actually lives.
That is genuinely useful for a real and common category of slowness. It is also frequently misunderstood as a general speed fix for problems it has no effect on at all.
What a CDN actually does
A CDN operates a network of edge servers — points of presence in many different locations. When a visitor requests a file the CDN is configured to handle, typically images, CSS, JavaScript and other static assets, the request is routed to whichever edge server is closest to that visitor, not to your origin server directly. If that edge server already has a cached copy, it serves it immediately. If not, it fetches the file from your origin once, caches it, and serves the cached copy to everyone else nearby afterwards.
The practical effect is threefold:
- Shorter network distance. A visitor gets static files from a server near them rather than one that might be on another continent.
- Less load on your own server. Every request an edge server answers from cache is a request your origin server never has to handle at all.
- Some resilience during a spike. Because cached files are served from the edge, a sudden surge of traffic for the same static assets does not hit your origin server directly, which is one part of handling a traffic spike.
What a CDN does not do
This is the part that gets oversold. A CDN caches and redistributes files — it has no ability to fix problems that exist before a file is generated or that have nothing to do with distance at all.
- An unoptimised image. A five-megabyte photo served from a nearby edge server is still a five-megabyte photo. It arrives with less network delay, but it is the same amount of data.
- A slow database query. Dynamic, uncached pages — a logged-in dashboard, a search results page, a cart total — are generated by your server on every request. A CDN sitting in front of that server does not make the query underneath run faster.
- Too much JavaScript. Distributing a script file closer to the visitor shortens the download slightly; it does not reduce how long the browser spends executing it once it arrives.
- A slow server response for dynamic content. Time to First Byte on a page that has to be generated fresh — not read from cache — depends on the server and the application, not on where the CDN's nearest edge happens to be.
In short: a CDN moves files closer to visitors. It does not shrink files, does not speed up code, and does not replace fixing the actual page.
Where it genuinely helps
The clearest case is a site with a geographically spread-out audience and a meaningful amount of static content — images, stylesheets, downloadable files, video. If your visitors are mostly in one country and reasonably close to your server already, the network-distance benefit is naturally smaller, because there is less distance to save in the first place. Is a CDN worth it for a small website goes through that specific case in more detail.
A CDN also helps disproportionately during unusual load — a launch, a press mention, a sale — because static assets get served from the edge instead of adding to whatever the origin server is already dealing with. That does not remove the need to handle dynamic requests properly; it takes one category of load off the table so the origin server can concentrate on what it actually has to compute.
How it interacts with caching
A CDN and page caching solve adjacent but different problems, and the strongest setup uses both. Page caching, covered in how page caching works, avoids regenerating a dynamic page on every request by storing a ready-made copy on the origin server. A CDN then takes that finished output — along with every image, script and stylesheet — and serves it from a location near the visitor instead of from the origin at all. One reduces the work; the other reduces the distance.
Setting expectations correctly
Hosting plans here include a free CDN, and turning it on is worth doing for almost any site — there is essentially no downside to caching static assets closer to visitors. What it will not do is fix a page that is slow because it is carrying too much uncompressed image weight, running an excessive amount of JavaScript, or generating every request from scratch with an expensive database query. Those need the fixes covered elsewhere in this section — compressing images, minifying scripts, and reducing database load — regardless of whether a CDN sits in front of the site or not.
The honest way to think about a CDN: it is a genuinely useful layer that removes network distance and takes static traffic off your origin server, and it is not, on its own, a fix for a heavy or badly built page.
Related reading
Usually yes to turn one on, but the honest answer depends on how spread out your actual visitors are.
How page caching worksWhy rebuilding a page from scratch on every visit is expensive, and what caching actually does instead.
What is TTFB and why does mine look high?What the wait before the first byte actually measures, and the short list of things that usually cause it.
How to survive a traffic spikeWhat actually breaks first when traffic surges, and the preparation that matters more than reacting in the moment.