System Design CDN
@amitmund
October 05, 2026
System Design for a CDN
Modern general-purpose CDNs rely on dedicated edge PoPs (Points of Presence) backed by Anycast BGP and high-throughput physical infrastructure.
Do You Need a P2P Network?
No, for a general-purpose CDN. P2P networks (like WebRTC data channels or BitTorrent-style meshes) introduce severe limitations for arbitrary web workloads:
High and Unpredictable Latency: A client fetching a 5 KB CSS file or an API payload needs sub-20ms Time To First Byte (TTFB). Discovering peers, establishing ICE/STUN/TURN handshakes, and coordinating chunk transfers adds hundreds of milliseconds of overhead.
NAT Traversal & Asymmetric Bandwidth: Consumer connections have slow upload speeds and strict symmetric NATs/firewalls that hinder client-to-client data serving.
Churn & Reliability: Browsers close tabs, mobile devices disconnect, and battery saver modes throttle connections. Relying on end users for cache availability violates standard SLA availability expectations.
When P2P makes sense: P2P is strictly an optimization for large, homogeneous payload delivery to massive concurrent audiences (e.g., live streaming World Cup finals via HLS/DASH, or OS/game patch distribution). In these edge cases, a hybrid model is used where an edge CDN serves the manifest and initial chunks, while clients trade static 2-second video segments among themselves inside the same ISP.
[ Anycast IP / DNS Steering ]
│
┌────────────┴────────────┐
▼ ▼
[ PoP 1: Edge Router ] [ PoP 2: Edge Router ]
│ │
[ L4 LB (Maglev/DPDK) ] [ L4 LB (Maglev/DPDK) ]
│ (Consistent Hash) │
┌────────┴────────┐ ┌────────┴────────┐
▼ ▼ ▼ ▼
[ Cache Node 1 ] [ Cache Node 2 ] ...
- RAM (L1) - RAM (L1)
- NVMe (L2) - NVMe (L2)
│ (Edge Miss)
▼
[ Regional Shield / Tiered Cache ]
│ (Shield Miss)
▼
[ Customer Origin Server ]
Related Questions
What is Anycast BGP?
What is Time To First Byte (TTFB)?
What is Anycast IP?
What is DNS Steering?
DNS steering is the practice of using DNS responses to control where a user's request is sent.
In simple terms:
DNS steering = deciding which IP address or service endpoint DNS should return to a client based on rules or conditions.
api.example.com
|
v
DNS
/ | \
/ | \
v v v
203.0.113.10 203.0.113.20 203.0.113.30
US-East Europe Asia
DNS
|
+----------+----------+
| | |
v v v
US-East Europe Singapore
| | |
100ms 80ms 25ms
| | |
+----------+----------+
|
Choose
Singapore
Latency Probes
Latency probes
┌─────────────────┐
│ DNS/Monitoring │
│ infrastructure │
└────────┬────────┘
|
┌────────────┼────────────┐
↓ ↓ ↓
Mumbai Singapore London
25 ms 70 ms 150 ms