A content delivery network, or CDN, is a network of servers spread across many locations that keeps copies of a website’s content and serves each visitor from a server nearby. It speeds up websites mainly by shortening the distance data travels and by sparing the site’s own server from answering the same request over and over.
What a CDN actually is
A website has an origin: the server, or group of servers, where the site’s files and logic live. Without a CDN, every visitor’s browser talks directly to that origin, whether the visitor is across the street or across an ocean.
A CDN inserts a layer between the two. Its servers sit in many data centers around the world and are often called edge servers, because they are at the edge of the network, close to users. When a visitor asks for an image, a style sheet or a script, the nearest edge server answers if it already holds a copy. If it does not, it fetches the file from the origin, hands it to the visitor and keeps a copy for the next person.
Most CDN providers are commercial companies, and much of what is published about their performance comes from the companies themselves. That is worth keeping in mind when reading speed claims, and the examples below say whose figures they are.
How does a CDN speed up a website?
Three effects do most of the work.
Shorter distance. Data moves quickly but not instantly, and every round trip between browser and server takes time. That delay is called latency. A page needs many requests, and each one that travels to a distant origin pays the delay. Serving from a nearby edge server cuts the distance, and the saving repeats for every file on the page.
Fewer trips to the origin. If an edge server can answer from its stored copy, the origin never sees the request. The origin then has less work, which helps when traffic spikes and leaves it free to handle requests that truly need its attention, such as logging in or checking out.
Better paths for the requests that do reach the origin. Providers also keep warm connections to origin servers and, in some designs, funnel misses through a small number of larger data centers first, which the next sections describe.
None of this makes the origin itself faster. A CDN changes where and how often it is asked.
What happens on a cache hit and a cache miss?
The central idea is the cache: a store of copies kept so they need not be fetched again. Each request to an edge server ends in one of two ways.
- Cache hit: the edge server has a usable copy and returns it immediately.
- Cache miss: it does not, so it must fetch the content from further back and, usually, store it.
The share of requests answered from cache is the cache hit ratio. A higher ratio means less origin traffic and, generally, faster pages.
Many providers add middle layers. According to Cloudflare’s engineering blog, a visitor’s request goes first to the nearest data center, which the company calls the lower tier. On a miss, that data center asks an upper-tier data center rather than the origin, and only if the upper tier also lacks the content does the request reach the origin. The aim, Cloudflare says, is to limit how many data centers contact the origin for the same file. The company also describes a regional tier that sits between the two in some cases. Cloudflare reports that in trials customers saw a 50 to 100 millisecond improvement in the slowest cache-hit responses with the regional tier. That figure is the company’s own and was not independently verified, and it applies to that product, not to CDNs in general.
How does a visitor reach the nearest server?
A visitor types a name, not a location, so something must steer the browser to a nearby edge server. Usually this happens during the name lookup. The site’s name is set up so that the answer points toward a CDN server, chosen by the provider based on where the request seems to come from and which servers are available. Some providers instead use anycast, a technique in which many servers share one address and the network’s routing delivers each request to a nearby one.
The mechanics of name lookups are covered in our explainer on how DNS works and why outages spread, and the wider picture of addresses and routing is in how the internet works. A CDN builds on both.
How a CDN decides what it may keep
Not everything can or should be stored. The site’s origin tells caches what to do through HTTP headers, small labeled instructions sent along with each response. The standard that defines HTTP caching is published by the Internet Engineering Task Force. The headers that matter most in practice are these:
| Header idea | What it tells a cache |
|---|---|
| Cache-Control with a lifetime | How long a copy may be reused before it is considered stale |
| Cache-Control “no-store” | Do not keep this response at all |
| Cache-Control “private” | Only the visitor’s own browser may keep it, not shared caches |
| ETag or Last-Modified | Markers used to ask the origin whether a stale copy is still current |
| Vary | Which request details, such as language or format, change the response |
Stale does not always mean thrown away. A cache can ask the origin whether its copy is still valid and, if so, keep using it without downloading the file again. That check is cheaper than a full fetch.
Static files such as images, fonts, scripts and style sheets are the easiest to cache, because every visitor gets the same bytes. Personalized pages, shopping carts and account screens are harder, because the content differs per person and must not leak between visitors.
A worked example with illustrative numbers
The figures below are invented to show the arithmetic, not measurements of any real site.
Suppose a page triggers 1,000 requests for images and scripts in an hour, and the edge servers answer 900 of them from cache. The hit ratio is 900 divided by 1,000, or 90 percent. The origin handles the other 100 requests, a tenfold reduction compared with having it answer all 1,000.
Now suppose a configuration error makes half of those files uncacheable. Only 450 requests can be hits, so the hit ratio falls to 45 percent and the origin handles 550 requests, 5.5 times as many as before. The CDN is still there, but much of its benefit is gone. Speed gains follow the same logic: each request that can be answered nearby saves a long trip, and each request that cannot saves nothing.
Common mistakes and misconceptions
“A CDN makes any site fast.” It speeds up delivery, not the work a server does to build a page. A slow database query or a heavy script still takes as long. Content that is different for every visitor often cannot be cached and goes to the origin regardless, although providers say they can improve the route those requests take.
Cookies that block caching. Cloudflare’s engineering blog describes a common case: a cookie-setting header attached to a static file, such as a script, can make it uncacheable, so requests go back to the origin. Overly restrictive caching instructions or frequently changing ETag values cause similar trouble. The company introduced rules in July 2026 that let customers strip or rewrite such headers at its edge before storing a response, and says this needs no change to the origin. That is a vendor feature and its effectiveness is the company’s claim, but the underlying problem, where a site’s own headers defeat caching, applies to any CDN.
Too many variants. The Vary header tells caches that a response depends on certain request details. Cloudflare’s September 2026 post explains that if raw values differ in trivial ways, such as the order of language tags or capitalization, one response can be split into many rarely reused cache entries, which lowers the hit ratio and sends more traffic to the origin. The post cites an analysis by the standards contributor Mark Nottingham finding almost 3,000 of nearly 50,000 sites varying on four or more fields. That count comes from his analysis as cited by Cloudflare, not from the company’s own measurement.
Forgetting to refresh. Cached copies can go out of date. Sites need a way to clear or replace content after a change, and a copy held in a visitor’s browser may linger even after the CDN has been updated.
“A CDN is only about speed.” Speed is the headline benefit, but sharing the load also helps a site absorb sudden surges, and providers commonly add protections against hostile traffic. Those features vary by provider and plan and should be assessed separately from caching.
What a CDN does not change
A CDN adds a dependency. If the provider has a fault, many sites that rely on it can fail together, a pattern described in our piece on why one cloud failure spreads so far. It also adds another party that handles visitors’ requests, which raises privacy and contractual questions for site owners.
Newer transport protocols also change the picture slightly. They reduce the cost of each round trip, which complements what a CDN does; our explainer on HTTP/3 and QUIC covers that change. Where a site’s audience sits also matters. A site whose visitors are all in one city, served from an origin in that city, gains little from distribution, while a site with a global audience gains the most.
What varies by site and by place
Results depend on the mix of content, how much of it is cacheable, how many edge locations the provider has near the audience, and how well headers are set. Coverage is uneven across the world, so visitors in regions with fewer nearby edge locations may see smaller improvements. Providers publish their own figures, such as Cloudflare’s customer-reported cache hit rates for individual projects, but these are vendor-reported and reflect particular workloads. The most reliable test for a given site is to compare real load times and hit ratios before and after, rather than relying on any general number.
The short version for site owners and curious readers
A CDN is a geographic cache. It helps most when content is the same for many visitors, headers allow it to be stored, and the audience is far from the origin. It helps least when pages are built per person, when cookies or variants fragment the cache, or when the bottleneck is the origin’s own processing. Understanding hits, misses and the headers that govern them explains most of what happens when a CDN works well, and most of what goes wrong when it does not.
This article is general information about web technology and is not a substitute for professional technical advice.
Sources: Cloudflare Blog



