What is a CDN?
A Content Delivery Network (CDN) is a globally distributed network of servers that caches and delivers web content from locations closest to the user. Instead of every request traveling to your origin server, nearby CDN edge nodes serve cached copies.
How CDNs Work
- User requests a resource (image, CSS, HTML)
- DNS routes the request to the nearest CDN edge server
- If cached (cache hit), the edge serves it instantly
- If not cached (cache miss), the edge fetches from origin, caches it, then serves it
Benefits
- Speed: Content served from nearby servers reduces latency by 50-90%
- Reliability: Distributed infrastructure handles traffic spikes and DDoS attacks
- Cost: Reduces origin server bandwidth and compute load
- SEO: Faster page loads improve search rankings (Core Web Vitals)
Major CDN Providers
- Cloudflare: Free tier, excellent DDoS protection, 300+ edge locations
- AWS CloudFront: Deep AWS integration, 400+ edge locations
- Fastly: Real-time purging, edge computing (Compute@Edge)
- Vercel/Netlify: CDN built into the deployment platform
When You Don't Need a CDN
Very small sites with local audiences, or applications where every request must hit the origin (real-time data, personalized content) may not benefit much from a CDN.