A CDN (Content Delivery Network) is a distributed network of servers that delivers web content from locations geographically close to end users. Instead of every request traveling to a single origin server that may be thousands of kilometers away, a CDN serves cached content from the nearest edge server, reducing latency from hundreds of milliseconds to single digits.
Key takeaways
- A CDN caches content on edge servers close to users, reducing latency.
- CDNs offload 60-90% of static traffic from origin servers.
- Modern CDNs provide DDoS protection, WAF, and edge computing.
- Major providers: Cloudflare, Akamai, AWS CloudFront, Azure CDN.
- Cache-Control headers control how long edge servers cache content.
Quick explanation
In simple terms
A CDN delivers website content from servers close to you, making pages load faster.
Technical definition
A CDN is a geographically distributed network of proxy servers and edge caches that serve content from the nearest Point of Presence (PoP), using DNS-based anycast routing, cache-control headers for TTL management, and origin pull for cache misses.
Analogy
A CDN is like a chain of local warehouses for a global online store. Instead of shipping every order from one central warehouse (origin server), the store pre-stocks popular items in warehouses near customers (edge servers). Local delivery is faster and reduces pressure on the central warehouse.
Definition
A CDN is a distributed network of servers that caches and delivers web content from locations geographically close to users, reducing latency, offloading origin server traffic, and providing DDoS protection.
A CDN (Content Delivery Network) is a geographically distributed network of proxy servers and data centers that cache and deliver web content from locations close to end users. Instead of every request traveling to the origin server, the CDN routes users to the nearest edge server (Point of Presence) using DNS-based anycast routing.
CDNs cache static assets (images, CSS, JavaScript, video) and increasingly dynamic content. Modern CDNs also provide DDoS protection, Web Application Firewall (WAF), SSL/TLS termination, image optimization, and edge computing capabilities (serverless functions running at the edge).
Why it matters
Core concepts
Edge server (PoP)
A server at the network edge that caches content and serves it to nearby users.
Edge servers (also called Points of Presence or PoPs) are the CDN's delivery endpoints. They cache content from the origin and serve it to users in the same geographic region. When content isn't cached (cache miss), the edge server fetches it from the origin, caches it, and serves it to the user.
Example
A CDN edge server in Frankfurt serves cached images to German users instead of routing requests to an origin server in Virginia.
Origin server
The upstream server that hosts the original content. The CDN caches content from the origin.
The origin server is the source of truth. CDN edge servers pull content from the origin when the cache is empty or expired. Cache-Control headers (max-age, s-maxage, stale-while-revalidate) control how long edge servers keep cached content before revalidating with the origin.
Example
An nginx web server in AWS us-east-1 running a Django application.
How it works
User request routed to nearest edge
A user requests a webpage or asset (image, CSS, JS). The DNS resolves the CDN's hostname to the nearest edge server based on the user's location.
User → DNS → Nearest edge
Cache hit or miss
The edge server checks its cache. If the content is cached and not expired (cache hit), it serves it immediately. Cache hit ratios of 90%+ are common for static assets.
Edge cache check
Origin fetch and cache fill
On a cache miss, the edge server fetches the content from the origin server, caches it for future requests, and serves it to the user.
Edge → Origin → Cache + Serve
Subsequent requests served from cache
Subsequent users in the same region receive the cached content directly from the edge server without hitting the origin.
Cached content served
Benefits
Reduced latency via geographic proximity
CDN edge servers are geographically distributed. Users receive content from the nearest edge server, reducing round-trip time from hundreds of milliseconds to single digits.
Origin offloading
CDN edge servers handle cached content, reducing traffic to the origin server by 60-90% for static assets. This prevents origin overload during traffic spikes.
DDoS protection and WAF
CDN networks absorb volumetric DDoS attacks by distributing traffic across a global network of edge servers. Per Cloudflare, their network has mitigated attacks exceeding 1 Tbps.
Limitations
Cache invalidation complexity
MediumCached content may be stale if cache headers are misconfigured. Dynamic content that changes per user (personalized pages, authenticated API responses) needs careful cache rules.
Workaround — Use appropriate Cache-Control headers (s-maxage, stale-while-revalidate). Implement cache purge APIs for content updates.
Cost at high bandwidth
MediumCDN services add cost based on bandwidth, requests, and features. High-traffic video and download sites can incur significant CDN bills.
Workaround — Use Cloudflare's free tier for basic CDN. Negotiate reserved pricing with enterprise CDN providers. Optimize assets (compression, image formats) to reduce bandwidth.
Examples
Netflix Open Connect CDN
Netflix delivers video content to millions of concurrent viewers across 190 countries without buffering.
Netflix uses its own CDN (Open Connect) with thousands of edge servers in ISP data centers worldwide. When a user streams a movie, the content is served from the nearest Open Connect appliance, not from Netflix's central servers.
Comparisons
CDN provider comparison
Myths, corrected
Myth
CDNs are only for large websites
Correction
Any website benefits from a CDN. Free tiers (Cloudflare) provide CDN, DNS, and DDoS protection at no cost. Even small sites see improved load times and security.
Why it happens: CDNs were historically enterprise products. Free tiers from Cloudflare and others have made them accessible to everyone.
Myth
CDNs only cache static files
Correction
Modern CDNs cache HTML, API responses, and dynamic content using edge computing (Cloudflare Workers, Lambda@Edge). They can also perform real-time image optimization, video transcoding, and A/B testing at the edge.
Why it happens: Traditional CDN usage focused on images, CSS, and JavaScript files.
Practical implications
For admins
Configure DNS to point to the CDN. Set Cache-Control headers on the origin. Monitor cache hit ratios and purge stale content after deployments.
For business
CDN improves page load times, which directly affects conversion rates. Per Google, 53% of mobile users abandon sites that take longer than 3 seconds to load.
For security
CDNs absorb DDoS attacks and provide WAF rules. Configure rate limiting and bot management at the CDN edge.
Related terms
Edge server
The nearest CDN server to the user, also called a Point of Presence.
Cache-Control
HTTP headers that control caching behavior (max-age, s-maxage, no-cache, no-store).
Anycast
DNS routing technique that directs users to the nearest CDN edge server.
Frequently asked questions
What is a CDN?
A CDN is a network of servers distributed worldwide that cache and deliver web content from locations close to users, reducing latency and improving load times.
Why do websites use a CDN?
Without a CDN, every request goes to the origin server, which may be thousands of kilometers away. With a CDN, the request is served from the nearest edge server, typically within 50ms.
Do CDNs protect against DDoS attacks?
Most CDNs provide DDoS protection by absorbing attack traffic across their global network. Per Cloudflare, their network can absorb multi-terabit DDoS attacks without impacting origin servers.
Can a CDN cache dynamic content?
Yes. Modern CDNs cache dynamic content using techniques like edge-side includes (ESI), dynamic content caching rules, and edge computing (workers/functions) that run application logic at the edge.
Conclusion
A CDN (Content Delivery Network) is a distributed network of edge servers that cache and deliver content from locations close to end users. CDNs reduce latency (by serving from the nearest edge), offload origin traffic (by caching static and dynamic content), and provide security (DDoS absorption, WAF).
Modern CDNs have evolved beyond static caching to include edge computing, serverless functions, image optimization, and full-site delivery. For most web applications, enabling a CDN is one of the highest-impact performance improvements available.
Main takeaway






