CDN Fundamentals

When a user in Tokyo requests an image from your server in New York, that request travels across the Pacific Ocean and back. The physics of light through fiber optic cables creates unavoidable latency. Content Delivery Networks solve this by putting copies of your content closer to users worldwide.

How CDNs Work

A CDN maintains servers — called edge servers or points of presence (PoPs) — in data centers around the world. When a user requests content, the CDN routes them to the nearest edge server.

Without a CDN, every request travels to your origin server:

User (Tokyo) → Origin Server (New York)
Round trip: ~200ms latency

With a CDN, the first request fetches from origin, but subsequent requests hit the cache:

User (Tokyo) → Edge Server (Tokyo)
Round trip: ~20ms latency

The edge server fetches content from your origin once, caches it, and serves all future requests from that cache. Users get faster responses, and your origin server handles less traffic.

What CDNs Optimize

Static assets benefit most from CDNs. Images, CSS, JavaScript, fonts, and videos rarely change and cache perfectly. A single cached file can serve millions of requests.

Latency reduction comes from geographic proximity. Edge servers in 200+ locations mean most users are within 50ms of cached content.

Origin load reduction protects your servers. Instead of handling every request, your origin only serves cache misses. During traffic spikes, the CDN absorbs most load.

DDoS protection is a side benefit. CDNs can absorb massive traffic volumes that would overwhelm origin servers. Many include built-in attack mitigation.

SSL/TLS termination at the edge means encrypted connections don't add latency. The CDN handles HTTPS, often with automatic certificate management.

Choosing a CDN

Cloudflare offers a generous free tier with security features and integrates with their R2 storage. Great for most projects.

AWS CloudFront integrates seamlessly with S3 and other AWS services. The natural choice if you're already on AWS.

Fastly provides developer-friendly configuration and real-time cache purging. Popular with companies needing fine-grained control.

Bunny CDN keeps things simple and affordable. Good for straightforward static content delivery.

Vercel and Netlify include CDN functionality built into their platforms. If you're deploying there, you get edge caching automatically.

See More

Further Reading

Last updated December 26, 2025

You need to be signed in to leave a comment and join the discussion