Web Development

What is a CDN?

A CDN is a network of geographically distributed servers that cache and deliver content close to users for faster, more reliable loading.

A CDN (Content Delivery Network) is a network of servers spread across the world that store copies of your website's content close to your users. Instead of every visitor fetching files from one origin server, they get them from a nearby edge server — making pages load faster.

How It Works:

  1. Your content is cached on edge servers in many locations
  2. A user requests a file (image, script, video)
  3. The CDN serves it from the closest edge server
  4. If it's not cached there, the CDN fetches it from the origin and stores it

What It Speeds Up:

  • Static assets: Images, CSS, JavaScript, fonts
  • Video streaming: Buffering less by serving locally
  • Large downloads: Software, files, updates
  • Dynamic content: Increasingly cached at the edge too

Benefits:

  • Speed: Lower latency from proximity
  • Reliability: Traffic spread across many servers
  • Scalability: Absorbs traffic spikes
  • Security: Often includes DDoS protection

FAQ

Does a CDN replace my server?

No. The origin server still holds the source of truth and handles requests the CDN can't serve from cache. The CDN sits in front to speed up and offload delivery.

What is cache invalidation on a CDN?

When you update content, you may need to "purge" the CDN cache so it fetches the fresh version. Many CDNs support cache-busting via versioned URLs or purge APIs.

Promote your content

Reach over 400,000 developers and grow your brand.

Join our developer community

Hang out with over 4,500 developers and share your knowledge.