What is a CDN? Content Delivery Networks Explained

A Content Delivery Network (CDN) is a geographically distributed network of servers that delivers web content from locations close to end users. CDNs reduce latency, improve load times, and absorb traffic spikes by caching content at the network edge — often within the same city as the user, rather than serving everything from a central origin server that might be thousands of miles away.

The Problem CDNs Solve

Without a CDN, every user who visits a website hits the same origin server. A startup based in New York serving users in Tokyo, Nairobi, and São Paulo imposes intercontinental round-trip latency on every request. A 200ms round trip across the Pacific means a simple page with 20 requests stacks up to seconds of latency, and that is before any content is actually downloaded.

TCP's congestion control behavior makes this worse: the slow-start phase requires multiple round trips to ramp up to full throughput. Across a 150ms intercontinental path, reaching 10 Mbps throughput from slow start takes several seconds. A CDN edge node 5ms away reaches the same throughput in milliseconds.

How CDNs Route Users to the Edge

CDNs use two primary mechanisms to direct users to nearby edge nodes:

Anycast is simpler from the client's perspective — the IP address is stable, DNS TTL games are unnecessary — but it places more weight on peering relationships to ensure "nearest" in BGP terms correlates with "nearest" in geographic terms.

What CDNs Cache

CDN edge nodes cache content based on HTTP caching headers sent by the origin server:

Content that cannot be cached — authenticated pages, shopping carts, user-specific API responses — is proxied to the origin on every request. Even then, the CDN's TCP connection to the origin is maintained as a persistent pool (avoiding handshake overhead), and the user-to-edge leg benefits from low latency.

CDN Request Flow User (Tokyo) CDN Edge (Tokyo) Cache HIT: serves locally CDN Edge (Tokyo) Cache MISS: fetch from origin Origin Server (New York) 5ms RTT cached response 5ms to edge 150ms to origin On cache miss, edge fetches from origin once, then serves subsequent users locally

CDN as DDoS Protection

A CDN's distributed architecture provides inherent resistance to distributed denial-of-service attacks. Attack traffic directed at an anycast CDN address is automatically spread across all edge nodes worldwide. A 1 Tbps attack absorbed by a CDN with 300 PoPs averages ~3 Gbps per location — manageable for a large network.

Beyond volume distribution, CDNs operate at the TCP layer: they terminate connections from clients at the edge and proxy valid requests to the origin. This means:

CDN Peering Strategy

CDN performance depends heavily on peering strategy. To be "close" to every user in BGP terms, a CDN must peer directly with the user's ISP or be present at an IXP where that ISP is also connected. This minimizes the number of AS hops — and therefore latency — between the CDN edge and the end user.

Cloudflare (AS13335) is the most extreme example: it peers at over 300 IXPs and has direct private peering with most major ISPs globally. When you look up AS13335, you see hundreds of peer relationships and extremely short AS paths.

Akamai (AS20940) takes a different approach: it embeds caching servers directly inside ISP networks under commercial agreements, so traffic served by Akamai may not even traverse the ISP's peering fabric at all — it comes straight from a server inside the ISP's own data center.

Major CDN Providers

ProviderASNKey approach
CloudflareAS13335Anycast, 300+ PoPs, aggressive IXP peering
AkamaiAS20940ISP-embedded servers, oldest CDN
FastlyAS54113Programmable edge, Varnish-based caching
Amazon CloudFrontAS16509AWS-integrated, 400+ PoPs
Google Cloud CDNAS15169Integrated with GCP, Google's own backbone

CDNs and the BGP Routing Table

CDN providers announce hundreds to thousands of prefixes from their autonomous systems. Because they use anycast, the same prefix may appear to be reachable via many different paths from different vantage points — each path actually leads to a different physical edge node serving the same IP address.

See BGP routing data in real time

Open Looking Glass
← Previous How Does Traceroute Work?
More Articles
What is DNS? The Internet's Phone Book
What is an IP Address?
IPv4 vs IPv6: What's the Difference?
What is a Network Prefix (CIDR)?
How Does Traceroute Work?
What is DNS over HTTPS (DoH)?