All articles
CDNSystem DesignNetworkingPerformance

The Feynman Guide to Content Delivery Networks

Demystifying how the internet delivers content at lightning speed using the Feynman Technique, pizza analogies, and the hidden magic of edge servers.

25 May 20268 min read

Every time you load a webpage, stream a movie on Netflix, or scroll through your social media feed, there is a silent, invisible system working behind the scenes to make it feel instant. Without it, the internet would feel like dial-up in the 90s—agonizingly slow, constantly buffering, and perpetually frustrating.

This system is called a Content Delivery Network, or CDN.

Despite being the backbone of the modern internet, most engineers have only a vague, hand-wavy understanding of how CDNs actually work. Let's fix that using the Richard Feynman Technique—breaking down the complex engineering of CDNs into simple, everyday analogies that anyone can understand.


1. The Problem: Why One Server Isn't Enough

Imagine you open a single pizza restaurant in Madrid. Your pizza is legendary. Word gets out, and suddenly people in Tokyo, São Paulo, Sydney, and New York want to order your pizza.

There's a problem. Every single order has to be fulfilled from your single kitchen in Madrid. A customer in Tokyo places an order—the pizza has to travel 10,000 km. By the time it arrives, it's cold. The customer in Sydney? Even worse. And during peak hours, your single kitchen is overwhelmed with thousands of global orders at once.

This is exactly what happens when a website runs on a single origin server. A user in Australia requesting a webpage hosted in Virginia, USA, has to send a request across the Pacific Ocean, wait for the server to process it, and then wait for the response to travel all the way back. Every millisecond of that round trip is called latency, and it's the number one enemy of user experience.

CDN Global Network A CDN distributes copies of your content to edge servers across the globe, dramatically reducing the distance between the user and the data.

The Concept: A Content Delivery Network solves this by placing copies of your content on hundreds or thousands of servers distributed across the globe. These servers are called Edge Servers or Points of Presence (PoPs). When a user requests your website, the CDN routes them to the nearest edge server instead of the faraway origin. The data travels a few hundred kilometers instead of ten thousand.


2. The Pizza Chain Analogy: Edge Caching

The solution to our pizza problem isn't to build a faster oven in Madrid. It's to open franchise locations in every major city. Each franchise pre-stocks the most popular pizzas. When a customer in Tokyo orders a Margherita, the local Tokyo franchise serves it instantly from its own supply—no need to call Madrid at all.

CDN Pizza Analogy Instead of every request traveling to the distant origin server, CDN edge servers cache content locally, serving it to nearby users in milliseconds.

This is Edge Caching, and it is the fundamental mechanism of every CDN. Here's how it works:

  1. First Request (Cache Miss): The first customer in Tokyo requests your homepage. The Tokyo edge server doesn't have it yet, so it fetches it from the origin server in Madrid, serves it to the user, and stores a copy in its local cache.
  2. Subsequent Requests (Cache Hit): The next hundred customers in Tokyo request the same homepage. The edge server already has the copy. It serves it directly—without ever touching the origin server. Response time drops from 300ms to 20ms.

The origin server is now relaxed. It only gets contacted when the cache expires or a genuinely new piece of content is requested. This concept—reducing the load on the origin while speeding up delivery—is the beating heart of a CDN.


3. The Smart Receptionist: DNS-Based Routing

So how does the CDN know which edge server to send a user to? The answer lies in the Domain Name System (DNS)—the internet's phonebook.

When you type www.example.com into your browser, your computer doesn't know where that is. It asks a DNS server: "What is the IP address of www.example.com?" Normally, the DNS returns the IP of the origin server. But with a CDN, something smarter happens.

CDN DNS Routing The CDN's intelligent DNS server acts like a smart receptionist, directing each user to their nearest and healthiest edge server.

The CDN operates its own Intelligent DNS Server. When a user's DNS query arrives, the CDN doesn't just blindly return an IP. It considers:

  • Geographic proximity: Where is this user located? Route them to the nearest edge server.
  • Server health: Is the nearest edge server overloaded or down? Route to the next best one.
  • Network conditions: Is there congestion on a particular path? Route around it.

This entire decision happens in microseconds, and the user never knows it occurred. They simply experience a fast-loading page.


4. Cache Hit vs. Cache Miss: The Hot Kitchen

Understanding the difference between a Cache Hit and a Cache Miss is crucial to understanding CDN performance.

Think of the edge server as a kitchen with a warming shelf. If a dish is already on the shelf (a Cache Hit), the waiter grabs it and serves it in seconds. If the dish isn't on the shelf (a Cache Miss), the kitchen has to cook it from scratch—the waiter walks to the back, fires up the stove, waits for it to cook, puts a copy on the warming shelf for next time, and then serves it. Much slower.

CDN Cache Hit vs Miss A Cache Hit is served instantly from the edge. A Cache Miss requires a round trip to the origin server, adding significant latency.

The performance of a CDN is often measured by its Cache Hit Ratio—the percentage of requests served directly from the edge cache without touching the origin. A well-configured CDN achieves a hit ratio of 95-99%, meaning only 1-5% of requests ever reach the origin server.

Key factors that affect the cache hit ratio:

  • TTL (Time to Live): How long the CDN keeps a cached copy before considering it stale. A longer TTL means more cache hits but potentially stale content.
  • Cache Keys: The CDN uses the URL (and sometimes headers, cookies, or query strings) to identify unique content. Misconfigured cache keys can destroy your hit ratio.
  • Content type: Static assets (images, CSS, JavaScript) cache beautifully. Dynamic, personalized content (user dashboards, shopping carts) is much harder to cache.

5. Beyond Speed: The Shield

Most people think CDNs are only about speed. But one of the most powerful—and least understood—benefits of a CDN is security.

Remember our pizza franchise model? Now imagine a rival sends a flash mob of 100,000 fake customers to your original Madrid restaurant to overwhelm it. Your single kitchen collapses under the load. This is a Distributed Denial of Service (DDoS) attack.

CDN DDoS Protection A CDN absorbs massive attack traffic across its distributed edge network, shielding the origin server from being overwhelmed.

But with your franchise model (CDN), that attack is automatically distributed across hundreds of locations worldwide. No single location is overwhelmed. The CDN's edge servers absorb the attack traffic like a sponge, and the origin server remains calm and protected behind the shield.

Modern CDNs like Cloudflare, Akamai, and AWS CloudFront provide:

  • DDoS Mitigation: Absorbing terabits of malicious traffic per second.
  • Web Application Firewall (WAF): Filtering SQL injection, XSS, and other application-layer attacks at the edge.
  • TLS/SSL Termination: Handling the computational cost of encryption at the edge, offloading it from the origin.
  • Bot Management: Distinguishing legitimate users from malicious bots before traffic ever reaches your infrastructure.

The Verdict

A Content Delivery Network is not just a performance optimization—it is a fundamental architectural layer of the modern internet. By distributing content to the edge of the network, CDNs transform the laws of physics from a problem into a non-issue. Users get faster pages, origin servers get less load, and the entire system becomes more resilient against both traffic spikes and malicious attacks.

The next time a webpage loads instantly, remember: it's not magic. It's a CDN edge server, sitting quietly in a data center near you, serving a cached copy of that content before you even finished blinking.


References & Further Reading

This post synthesizes concepts from the core literature on content delivery networking:

  • Content Delivery Networks: Fundamentals, Design, and Evolution by Dom Robinson.
  • Content Delivery Networks: Web Switching for Security, Availability, and Speed by Scott Hull.
  • Content Distribution Networks: An Engineering Approach by Dinesh C. Verma.
  • A Practical Guide to Content Delivery Networks (2nd Edition) by Gilbert Held.

Join the Newsletter

Get deep-dive engineering guides and system design teardowns delivered straight to your inbox.

Powered by Substack. No spam, ever. Unsubscribe with one click.