26. CDNs
1
The picture to keep in your head2
26.1 Why use a CDN?3
26.2 What are edge locations (PoPs)?4
26.3 Pull vs push CDN: what's the difference?5
26.4 How do cache keys and headers work?6
26.5 How does purging work?7
26.6 What is an origin shield?8
26.7 Can the CDN handle dynamic content?9
26.8 How do CDNs deliver video (HLS, DASH)?10
26.9 What happens when the CDN fails?11
Memory card and where the analogy breaks12
Practice: five levels13
Interview questions14
Solutions15
Sources16
Code lab26. CDNs
Sources
3 min read+10 XP
Source notes
- HTTP caching (
Cache-Control,s-maxage,private,no-store, validators,Vary): IETF RFC 9111, "HTTP Caching", 2022.stale-while-revalidateandstale-if-error: IETF RFC 5861.immutable: IETF RFC 8246. - Fastly outage of 8 June 2021 (a valid customer configuration change triggered a bug introduced in a 12 May deployment; 85% of the network returned errors; detected within a minute; 95% of the network normal within 49 minutes): Fastly blog, "Summary of June 8 outage", checked 2026-10-08.
- HLS 6-second target segment duration: Apple, "HTTP Live Streaming (HLS) authoring specification for Apple devices", checked 2026-10-08. HLS: IETF RFC 8216. MPEG-DASH: ISO/IEC 23009-1.
- Origin shield and request collapsing: Amazon CloudFront documentation ("Origin Shield"); Fastly documentation ("Shielding").
- Edge compute: Cloudflare Workers, CloudFront Functions and Lambda@Edge documentation.
- Round-trip times, traffic volumes, page sizes and bitrate ladder are illustrative assumptions; arithmetic computed 2026-10-08.
- Level 3 and Level 4 code: tested 2026-10-08 (
code/ch26_cdn.py, all checks pass).