Loading content...
We've examined the individual components of CDN infrastructure—edge locations that serve users, origin servers that provide authoritative content. But a CDN is far more than the sum of these parts. The architecture that connects them—the routing decisions, caching hierarchies, control systems, and operational infrastructure—is what transforms scattered servers into a coherent global delivery network.
Understanding CDN architecture means understanding how a single user request flows through the entire system: from the initial DNS query, through intelligent routing, to cache lookup, potential origin fetch, and final response delivery. Each step involves engineering decisions that balance latency, consistency, cost, and reliability.
This page synthesizes our component-level understanding into a complete architectural view—the big picture that ties everything together.
By the end of this page, you will understand the complete request flow through a CDN, the layered caching hierarchy, intelligent routing mechanisms, control plane architecture, and how CDNs handle the operational complexity of global content delivery.
At the highest level, a CDN consists of three major layers:
Surrounding these are supporting systems:
A simplified CDN architecture:
┌─────────────────────────────────────────────────────────────────┐
│ CONTROL PLANE │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Config Mgmt │ │ Health Check │ │ Analytics/Logging │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
└──────────────────────────┬──────────────────────────────────────┘
│ (pushes config, collects metrics)
┌──────────────────────────▼──────────────────────────────────────┐
│ DATA PLANE │
│ │
│ USER ──DNS──▶ ┌────────────────────────────────────────────┐ │
│ │ EDGE LAYER (300+ PoPs) │ │
│ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │ │
│ │ │PoP│ │PoP│ │PoP│ │PoP│ │PoP│ │PoP│ ... │ │
│ │ └─┬─┘ └─┬─┘ └─┬─┘ └─┬─┘ └─┬─┘ └─┬─┘ │ │
│ └────┼─────┼─────┼─────┼─────┼─────┼────────┘ │
│ │ │ │ │ │ │ │
│ ┌────▼─────▼─────▼─────▼─────▼─────▼────────┐ │
│ │ MID-TIER LAYER (Regional Caches) │ │
│ │ ┌───────┐ ┌───────┐ ┌───────┐ │ │
│ │ │Shield │ │Shield │ │Shield │ │ │
│ │ │ (US) │ │ (EU) │ │(APAC) │ │ │
│ │ └───┬───┘ └───┬───┘ └───┬───┘ │ │
│ └──────────┼────────────┼────────────┼──────┘ │
│ │ │ │ │
│ ┌──────────▼────────────▼────────────▼──────┐ │
│ │ ORIGIN LAYER │ │
│ │ ┌────────────────────────────────────┐ │ │
│ │ │ Customer Origin Infrastructure │ │ │
│ │ │ (Web servers, Object Storage, │ │ │
│ │ │ API servers, etc.) │ │ │
│ │ └────────────────────────────────────┘ │ │
│ └────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────┘
This diagram represents logical layers. Physically, these layers may overlap—a Super PoP might function as both edge and shield. The layered model helps understand the flow; actual deployments are optimized for efficiency.
Let's trace a complete user request through every layer of CDN architecture, examining the decisions and processing at each step.
User action: Browser navigates to https://www.example.com/images/hero.jpg
What happens:
CDN DNS Server Processing:
Input: DNS query for www.example.com
From resolver IP: 198.51.100.42
EDNS Client Subnet: 192.0.2.0/24 (if provided)
CDN Logic:
1. Map resolver/user IP to geographic location
2. Check current health of PoPs in region
3. Check current load/capacity of candidate PoPs
4. Check customer-specific routing rules
5. Select optimal edge IP address(es)
Output: A record pointing to edge PoP
example: 104.16.132.229 (Cloudflare edge)
TTL: 300 seconds
Critical decisions at this stage:
What happens:
With TLS 1.3 and 0-RTT:
Edge server processing:
HTTP Request received:
GET /images/hero.jpg HTTP/2
Host: www.example.com
Accept: image/webp,image/apng,image/*,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Cache-Control: no-cache
Cookie: session=abc123
User-Agent: Mozilla/5.0...
Edge Server Processing Pipeline:
Request Parsing
Configuration Lookup
Security Checks
Request Modification (Edge Compute)
Cache Key Generation
www.example.com|/images/hero.jpg|brCache lookup sequence:
1. Memory Cache (hot tier)
Key: www.example.com|/images/hero.jpg|br
Result: MISS (not in memory)
2. SSD Cache (warm tier)
Key: www.example.com|/images/hero.jpg|br
Result: HIT
Object metadata:
- Size: 234,567 bytes
- Content-Type: image/jpeg
- Cache-Control: max-age=31536000
- ETag: "a1b2c3d4e5f6"
- Age: 3600 (cached 1 hour ago)
- Expires: far future
3. Freshness check:
- max-age: 31536000 (1 year)
- Current age: 3600 (1 hour)
- Fresh? YES (3600 < 31536000)
Result: CACHE HIT - Serve from edge cache
Response construction:
HTTP/2 200 OK
Content-Type: image/jpeg
Content-Length: 234567
Cache-Control: max-age=31536000, public
ETag: "a1b2c3d4e5f6"
Age: 3600
CF-Cache-Status: HIT
CF-Ray: 7a1b2c3d4e5f6-IAD
<binary image data>
Response optimizations:
Edge metrics update:
This entire flow—DNS lookup, TLS connection, request processing, cache lookup, response delivery—completes in 10-50ms for a cache hit. The critical insight: no origin contact required. Origin servers, potentially thousands of kilometers away, are never touched.
What happens when content isn't in cache? Let's trace the cache miss flow, including mid-tier cache and origin fetch.
Continuing from Step 4 with a different scenario:
1. Memory Cache: MISS
2. SSD Cache: MISS
3. HDD Cache: MISS (or content expired)
Result: CACHE MISS - Must fetch from upstream
Decision point: Where to fetch from?
Edge → Shield communication:
GET /images/hero.jpg HTTP/1.1
Host: www.example.com
X-Forwarded-For: 192.0.2.100
X-Forwarded-Proto: https
CF-Connecting-IP: 192.0.2.100
Accept-Encoding: gzip, br
If-None-Match: "old-etag" (if revalidating)
Shield processing:
Shield cache advantage:
Request coalescing at shield:
Shield/Edge → Origin communication:
GET /images/hero.jpg HTTP/1.1
Host: www.example.com
X-Forwarded-For: 192.0.2.100, 104.16.132.229
X-Forwarded-Proto: https
X-Origin-Auth: <secret-token>
Accept-Encoding: gzip, br
If-None-Match: "old-etag" (conditional request)
Origin processing:
Origin response:
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Length: 234567
Cache-Control: max-age=31536000, public
ETag: "a1b2c3d4e5f6"
Last-Modified: Mon, 01 Jan 2024 00:00:00 GMT
Vary: Accept-Encoding
<binary image data>
Shield caching:
Edge caching:
Total latency components (cache miss):
| Component | Typical Latency |
|---|---|
| DNS Resolution | 5-50ms |
| TCP/TLS to Edge | 10-30ms |
| Edge Processing | 1-5ms |
| Edge → Shield | 20-50ms |
| Shield Processing | 1-5ms |
| Shield → Origin | 50-200ms |
| Origin Processing | 10-500ms (varies widely) |
| Response propagation | Similar return path |
| Total | 100-500ms+ typical |
Cache misses are 5-50x slower than cache hits. This dramatic difference is why cache hit ratio is the most important CDN metric. Every percentage point improvement in hit ratio significantly improves average user experience.
Modern CDNs implement sophisticated multi-tier caching to optimize for both speed (serve from fastest tier) and efficiency (maximize cache hit ratio). Understanding this hierarchy is essential for CDN optimization.
┌─────┐
│ RAM │ ← Fastest, smallest (GB scale)
┌┴─────┴┐
│ SSD │ ← Fast, medium (TB scale)
┌┴───────┴┐
│ HDD │ ← Slower, large (tens of TB)
┌┴─────────┴┐
│ Shield │ ← Regional cache
┌┴───────────┴┐
│ Origin │ ← Authoritative source
└─────────────┘
Each tier has different characteristics:
| Tier | Latency | Capacity | Hit Ratio Contribution | Cost |
|---|---|---|---|---|
| RAM | ~100μs | 64-256GB | Top 1-5% of content | High |
| SSD | 0.1-1ms | 1-10TB | Next 10-20% | Medium |
| HDD | 5-20ms | 50-200TB | Long tail | Low |
| Shield | 20-50ms | Aggregate of region | Shared across PoPs | Variable |
| Origin | 50-500ms | Unlimited | Final fallback | Customer cost |
Content moves between tiers based on access patterns:
Promotion (moving to faster tier):
Demotion (moving to slower tier):
Access pattern examples:
| Pattern | Tier Behavior |
|---|---|
| Viral content | Rapidly promoted to RAM, stays during peak |
| Steady popular content | Lives in SSD tier |
| Long-tail content | Stored on HDD, may be evicted entirely |
| One-time access | Never promoted past initial tier |
| Burst then forgotten | Promoted, then demoted as access drops |
Beyond single-server tiers, CDNs implement regional caching strategies:
Tiered Distribution:
Example: Cloudflare Tiered Cache
User → Edge PoP → Regional Tier → Origin Shield → Origin
↓ ↓ ↓
(Miss) (Miss) (Miss)
↓ ↓ ↓
Check Check Check
Regional Shield Origin
Benefits of regional tiering:
CDN architecture includes sophisticated routing systems that determine which edge serves each user, how requests flow through tiers, and how to handle failures or performance degradation.
The foundational routing strategy: serve users from nearby PoPs.
Implementation approaches:
DNS-Based Geo-Routing:
Anycast Routing:
Performance-Based Routing:
Real-time health tracking:
Health check types:
Failure response:
Normal: User → PoP A (nearest, healthy)
PoP A fails health check:
- DNS stops returning PoP A IPs
- Anycast withdraws PoP A routes
- Users automatically route to PoP B (next nearest)
- Failover completes in seconds to minutes
Capacity-based routing decisions:
Overflow handling:
PoP A at 90% capacity:
- Reduce weight in DNS responses
- New connections routed to PoP B
- Existing connections complete normally
- Gradual rebalancing as load changes
Spillover strategies:
Some CDNs route based on content characteristics:
Compute-optimized PoPs:
Storage-optimized routing:
Origin affinity:
While the data plane handles actual content delivery, the control plane manages configuration, monitoring, and coordination across the global CDN infrastructure.
Challenge: Distribute configuration changes to hundreds of PoPs within seconds.
Architecture patterns:
Push-Based Configuration:
Pull-Based Configuration:
Hybrid Approach:
Configuration versioning:
Distributed health checking:
Metric collection:
Alerting and automation:
CDNs terminate TLS for millions of domains:
Certificate provisioning:
Certificate distribution:
Renewal automation:
CDNs generate massive volumes of data—every request creates log entries, metrics, and telemetry. Making this data useful requires sophisticated analytics infrastructure.
Log fields captured per request:
Log volume challenges:
Log delivery options:
Cache Efficiency Metrics:
Performance Metrics:
Availability Metrics:
Traffic Metrics:
Use cases:
Implementation:
Alert examples:
We've explored the complete architecture of Content Delivery Networks—from high-level structure to detailed request flows. Let's consolidate the key takeaways:
Module Complete:
You've now completed this foundational module on CDNs. You understand:
With this foundation, you're prepared to explore deeper CDN topics: caching mechanics, cache invalidation, origin shields, dynamic content acceleration, and CDN provider comparison.
Congratulations! You now have a comprehensive understanding of CDN fundamentals—what they are, why they matter, and how they work. This knowledge forms the foundation for all subsequent CDN-related system design topics.