A CDN (Content Delivery Network) caches your content (images, CSS, JS, videos) on servers distributed globally. When a user in Tokyo visits your site, they get content from a Tokyo server, not your US server—much faster. Like having warehouses in every city instead of shipping everything from one location. CDNs also absorb traffic spikes and DDoS attacks. Common providers: Cloudflare, AWS CloudFront, Fastly. Essential for global apps.
Use a CDN when you have users globally (latency matters), serve static assets (images, videos, CSS, JS), need to handle traffic spikes, or want DDoS protection. Start with free tiers (Cloudflare, Vercel auto-CDN). Skip if all users are in one region or you only have dynamic content. Most modern hosting (Vercel, Netlify) includes CDN automatically.
System Design Patterns
Files from nearest location