Content Delivery Networks and Edge Caching
You'll learn how CDNs distribute static content globally to reduce latency and offload traffic from your origin servers.
What Is a CDN?
A Content Delivery Network (CDN) is a geographically distributed network of servers that cache and serve your static assets (images, CSS, JavaScript, videos) from locations physically closer to your users. Instead of every request traveling thousands of miles to your origin server, the CDN serves cached copies from nearby "edge" locations.
Think of it like a franchise restaurant chain: rather than everyone traveling to one central kitchen, you open locations in every city so customers can get their meal nearby without the long journey.
How Edge Caching Works
When a user requests a static file:
- The request goes to the nearest CDN edge server
- If the file is cached there (a "cache hit"), it's served immediately
- If not cached (a "cache miss"), the edge server fetches it from your origin server, caches it, then serves it
- Subsequent requests for that file are served from the edge cache
This dramatically reduces latency for distant users and prevents your origin servers from handling repetitive requests for the same static content.
Key Benefits
- Reduced latency: Users get content from nearby servers (milliseconds vs. hundreds of milliseconds)
- Lower origin load: Static assets account for most web traffic; offloading them frees your servers to handle dynamic requests
- Global scalability: Handle traffic spikes across regions without provisioning infrastructure everywhere
- Bandwidth savings: Your origin servers transfer less data
Key Takeaway: CDNs cache static assets at geographically distributed edge locations, serving content closer to users while dramatically reducing load on origin servers—essential for global-scale applications.