ARTICLE - CDN Acceleration

How CDN Works: From Edge Nodes to Global Delivery

One request shows where the time goes: a Europe-to-US-east round trip costs 90-140ms before content arrives, while a nearby edge node shortens that leg to a hop. The guide follows DNS, cache hit or origin fetch, TTL refresh and Anycast routing, then sets hit ratio against similar sites instead of a single number.

2026-08-06 Cloudflare Learning Center

How CDN Works: From Edge Nodes to Global Delivery

A Content Delivery Network (CDN) is a geographically distributed group of servers that speeds up content delivery by caching it closer to users. Understanding how it works is the foundation for configuring it correctly. If you are new to the concept, start with our CDN beginner's guide.

1. Core Components and the Request Chain

1.1 The Origin

The origin is where content is actually stored — your web server or object storage. A CDN does not replace hosting; it caches copies of origin content. Origins usually live in one or a few data centers, far from most users, which is the main source of latency.

1.2 Edge Nodes

Edge nodes are cache servers distributed around the world. CDN providers place nodes at Internet exchange points (IXPs) and other high-speed interconnection locations so users can connect nearby. Edge nodes typically combine fast storage (SSD), load balancing, and network optimizations.

1.3 A Complete Request Chain

User → DNS resolution → nearest edge node → cache hit? serve directly
                                          → miss? fetch from origin → cache → serve

When a user visits your site, the browser first resolves the domain to the nearest edge node IP. If the node has a cached copy, it returns it immediately; otherwise it fetches from the origin, caches the response, and returns it. How often the origin is hit directly determines origin load and user experience.

2. Caching and Origin Fetch

Asset type Caching settings in this guide How updates land Hit ratio and origin fetch
Static assets (CSS, JS, images, fonts) max-age=2592000 (30 days) plus immutable Add a content hash to filenames at build time; the URL changes instead At a 95% hit ratio, 100GB of traffic sends only 5GB to the origin
HTML pages max-age=60 plus must-revalidate A 60-second TTL with active purging Inherently lower than static assets
Dynamic APIs Cache public endpoints only; custom cache keys split region and language Dynamic requests go to the origin Naturally lower with personalised content
Removed or corrected content Do not wait for the TTL to expire Purge actively and let the page return 404 At a 50% hit ratio, origin fetch rises from 5GB to 50GB

2.1 Cache Hits and Misses

A cache hit means the edge node serves cached content directly — fast and free of origin bandwidth. A cache miss requires fetching from the origin, adding latency and cost. The hit ratio is the core metric for judging CDN configuration. See CDN cache hit ratio optimization and CDN cache strategy guide to improve it.

2.2 TTL and Cache Refresh

How long a cached copy lives is governed by TTL (Time to Live). Too short causes frequent origin fetches; too long delays updates. A common practice is long TTL for static assets (images, CSS, JS, fonts) and short TTL or active purging for HTML pages.

2.3 Controlling Caching with Response Headers

Whether a CDN caches content and for how long depends heavily on the response headers your origin returns. Here is a typical configuration:

# Static assets: long TTL + hashed filenames so stale caches expire naturally
location ~* \.(css|js|png|jpg|webp|woff2)$ {
    expires 30d;
    add_header Cache-Control "public, max-age=2592000, immutable";
}

# HTML: short TTL, let the CDN revalidate with the origin each time
location / {
    add_header Cache-Control "public, max-age=60, must-revalidate";
}

The key is tiering, not a blanket rule: images, CSS, and JS get long TTLs and hashed filenames generated at build time so stale copies expire naturally; HTML gets a short TTL with must-revalidate so page updates propagate to the edge quickly. If your hit ratio will not climb, the first thing to check is whether the origin is returning a Cache-Control header at all.

3. Anycast and Global Delivery

3.1 What Is Anycast

Anycast lets multiple nodes in different locations share the same IP address. When a user requests that IP, the network routes traffic to the nearest node automatically. This is how CDNs achieve "connect nearby," and it is also the basis for high availability — when one data center fails, Anycast shifts traffic to others with little user-visible impact.

3.2 Internet Exchange Points (IXPs)

IXPs are high-speed interconnection points where different networks meet. Deploying nodes at IXPs lets CDN providers cut cross-network transit cost and latency. This is why node density and IXP coverage are treated as key measures of network quality.

4. What a CDN Really Buys You

4.1 Shorter Physical Distance

The closer content is to users, the lower the round-trip latency. Turning a cross-border request into a same-city one often saves tens to hundreds of milliseconds.

Here is a measurable example: a global English-language site whose origin lives in the eastern United States. Without a CDN, a European user's request must cross the Atlantic, with round-trip times (RTT) typically between 90-140ms. With a CDN that has edge nodes in Europe, RTT drops to 20-40ms, saving 150-300ms on first paint. For e-commerce, this latency maps directly to bounce and conversion rates — Google research shows that for every 1-second increase in mobile load time, conversion can drop about 20%. In other words, a CDN does not just save "a little speed"; it saves real orders.

4.2 Lower Origin Bandwidth and Cost

Most requests are answered by edge nodes, so the origin only handles a small share of traffic. This reduces bandwidth bills, especially for cloud servers billed by bandwidth.

4.3 High Availability and Redundancy

The distributed nature of a CDN provides natural redundancy. Load balancing and intelligent failover redistribute traffic when individual nodes fail, improving uptime.

4.4 Edge Security

Sitting at the network edge, a CDN can block DDoS attacks and malicious traffic before they reach the origin, and centrally manage TLS certificates. See CDN security features for details.

  • Can dynamic APIs be accelerated by a CDN:Yes, but you need the right approach. Caching everything will break login state and personalized content. The usual practice is to cache only public endpoints (article lists, pricing) with custom cache keys that account for region/language, while dynamic requests go to the origin. Providers like Cloudflare also offer edge functions (Workers) for dynamic logic. 2.
  • Can a CDN replace a cloud server:No. A CDN caches "copies," so the origin must stay online; it solves distribution distance, not compute or storage. 3.
  • What is a normal hit ratio:Above 90% is typical for static-heavy sites. Sites with personalized or dynamic content naturally have lower ratios, which is fine. The point is to compare against similar sites and watch trends, not chase a single number.

5. 16IDC View: Getting the Most from a CDN

A common mistake we see at 16IDC is assuming that simply joining a CDN equals "acceleration enabled." In practice, results depend on three layers:

  • Origin quality: a slow origin or missing Cache-Control headers will drag down the whole experience when fetching;
  • Cache strategy: sensible TTLs and cache keys per content type directly affect the hit ratio;
  • Routing quality: node coverage, Anycast, and line-based routing should match where your users actually are.

For most small and mid-size sites, we recommend starting with a proven CDN acceleration setup, then gradually going deeper into CDN networking. Understanding the mechanism is not about rebuilding the wheel — it is about making accurate decisions when troubleshooting latency, evaluating providers, and controlling costs.

Source: https://www.cloudflare.com/learning/cdn/what-is-a-cdn/

References: Cloudflare cache documentation https://developers.cloudflare.com/cache/; MDN HTTP caching reference https://developer.mozilla.org/docs/Web/HTTP/Caching

Integration & Code Examples

Example 1: Follow DNS to the edge node

DOMAIN="www.example.com"
dig +short CNAME "$DOMAIN"
# Different regions resolve to different edge IPs — that is expected
dig "$DOMAIN" A +noall +answer
# Inspect the delegation chain and TTLs from the authoritative side
dig +trace "$DOMAIN" A 2>/dev/null | tail -n 10
# The end of the CNAME chain is usually the edge hostname
dig +short "$DOMAIN" | tail -n 1
# Check the TTL to know how fast a switch will take effect
dig "$DOMAIN" A +noall +answer | awk '{print "ttl=" $2}'

'Nearby' is the combined result of DNS steering and Anycast; different addresses per region are the design working, not a fault.

Example 2: Watch one object go from cold to warm

URL="https://www.example.com/hero.jpg"
# The first request is usually a MISS, the rest should be HIT
for i in 1 2 3; do
  printf 'req%s ' "$i"
  curl -s -o /dev/null -D - "$URL" \
    | grep -Ei "^(age|cache-control|x-cache|cf-cache-status):" \
    | tr -d '\r' | paste -sd' '
  sleep 3
done
# A rising age with a HIT status means the same edge copy is being served
# If age does not grow, check Cache-Control and the cache key

A rising age and a HIT status on the second request is the clearest difference between a cache hit and an origin fetch; no change points at the fetch path or the cache key.

Limitations

  • A CDN does not replace hosting; it caches copies of origin content.
  • Without a CDN, a European user's request must cross the Atlantic, with round-trip times (RTT) typically between 90-140ms.
  • In other words, a CDN does not just save "a little speed"; it saves real orders.
  • A CDN caches "copies," so the origin must stay online; it solves distribution distance, not compute or storage.

FAQ

Static assets cached for 30 days: how do updates go live?

With hashed filenames, not with the TTL. Give CSS, JS and images a content hash at build time so a change produces a new URL and the 30-day cache falls away naturally, and keep HTML at 60 seconds with must-revalidate so pages refresh quickly. Renaming files or purging manually is for emergencies only; the durable pattern ties the cache key to the content.

Where does the cost go when origin fetch stays high?

Into the origin leg. Edge hits never touch origin bandwidth, but every miss pulls data from it, and bandwidth-billed servers feel it first; dropping hit ratio from 95% to 50% moves the same 100GB from 5GB of origin fetch to 50GB. Fix Cache-Control before adding nodes, otherwise you just give more nodes a reason to fetch in parallel.

European users load slowly: where do you start debugging?

Confirm the request reaches the edge at all. Request the same asset three times from one region and watch whether age grows and the status reads HIT; if every call fetches from origin, the cache key and TTL are wrong, not the node footprint. A transatlantic round trip usually costs 90-140ms and drops to 20-40ms with European nodes, which is the gap worth comparing.

When is a CDN not a fit for a low-traffic site?

No need when visitors and origin share one region. At a few hundred daily requests the saved round trip is a few dozen milliseconds, while cache rules, certificates and origin config stay permanent maintenance, and the origin must still be online because a CDN only caches copies. Add one when cross-border traffic appears or origin bandwidth tightens.

Related Providers

  • Cloudflare: When you want to watch Anycast and tiered cache behaviour on a real path, use the free plan together with hit-ratio data.
  • Alibaba Cloud CDN: When the origin is in mainland China and per-directory TTL with a custom origin Host is needed, compare cache rules here.
  • Fastly: When origin response headers must be read at the edge and cache keys customised, validate the key design in VCL.
  • Cloudinary: When images must be transformed per device and pixel density to cut origin egress, place it in front of the CDN.

Community & Resources

Official docs and communities

Learning resources and tools

Original source: Cloudflare Learning Center ↗