CDN (Content Delivery Network)

Definition

A CDN is a distributed network of proxy servers (edge nodes) deployed in multiple data centers worldwide. It caches and serves content from the nearest geographic location to the user, reducing latency and bandwidth costs.

CDNs accelerate delivery of static content (images, CSS, JS, video), dynamic content, and API responses. They also provide DDoS protection, SSL termination, and WAF (Web Application Firewall) capabilities.

Key Concepts

  • Edge Nodes: Servers at the edge of the network, close to end users
  • Origin Server: The source server where content is originally hosted
  • Cache Hit/Miss: Cached content served from edge (hit) vs fetched from origin (miss)
  • TTL (Time To Live): How long content is cached before revalidation
  • Geographic Routing: DNS-based routing to nearest edge node
  • Purge/Invalidate: Force removal of cached content

CDN Architecture

User → DNS (CDN provider) → Nearest Edge Node → Cache Hit (fast)
                                           → Cache Miss → Origin Server → Cache + Serve

CDN Providers

Provider Key Features
Cloudflare Free tier, DDoS protection, WAF, edge computing
AWS CloudFront AWS integration, Lambda@Edge, global network
Fastly Real-time caching, edge compute, low latency
Akamai Largest CDN, enterprise-focused, edge computing
Azure CDN Microsoft Azure integration, multiple provider options
Google Cloud CDN Google global network, integrates with GCP services

CDN Use Cases

  • Static content acceleration: Images, CSS, JS, fonts
  • Video streaming: HLS/DASH adaptive bitrate streaming
  • API acceleration: Cached API responses at the edge
  • DDoS mitigation: Absorb and distribute attack traffic
  • SSL/TLS termination: Offload encryption at edge
  • WAF (Web Application Firewall): Block malicious requests