Home/Labs/CDN Anycast & Shield
All 280 Labs
INTERACTIVE LAB🌐

CDN Anycast Edge Lab (Interactive)

Route four world regions to Anycast PoPs, flip hit/miss, and stampede the origin with or without shielding. Trace BGP Anycast routing and cache lookups, compute hit versus miss TTFB per city, and watch origin-shield request collapsing crush thundering-herd load.

CDN Anycast & Origin Shield Lab

Route a user to the nearest PoP via BGP Anycast, then measure hit/miss TTFB and thundering-herd origin load.

Client (Anycast IP 198.51.100.1):
Edge PoP Sydney 🦘

Edge RTT 15ms · origin RTT 220ms

Shield / collapsing

REQUEST TRACE

› Press “Fetch asset” to trace BGP Anycast routing + cache lookup.

Edge HIT TTFB15ms

Local TLS termination + NVMe read.

No CDN, direct origin370ms

Trans-oceanic RTT × TCP slow start × repeated TLS from Sydney 🦘 to us-east-1.

CDN cuts latency ~96%

Origin load during burst

Concurrent origin fetches0

Origin bandwidth0 Mbps

Zero origin load — 97%+ of traffic absorbed at the edge (Spotify/Cloudflare pattern).

How It Works Under the Hood

Physics makes origins far: a Sydney user downloading from us-east-1 pays ~220ms transpacific RTT plus TCP slow start and TLS negotiation before the first byte, turning a 5MB asset into a multi-second load. CDNs deploy hundreds of edge PoPs that all advertise one Anycast IP, so BGP automatically steers packets to the topologically nearest data center where TLS terminates locally and NVMe cache answers in under 10ms. On viral misses, request collapsing merges duplicate waits at each PoP into a single origin fetch, and an Origin Shield tier collapses across all PoPs, turning thousands of stampede requests into roughly one stream.

Core Architectural Principles

  • Anycast: every PoP advertises the same IP; BGP shortest-AS-path routing picks the nearest one automatically.
  • Cache HIT TTFB is edge RTT; a MISS adds shield plus origin roundtrips — and BGP failover beats GeoDNS TTLs.
  • Request collapsing + Origin Shield merge concurrent duplicate misses into one origin fetch.
Interview Round Script

Explain Anycast mechanically — same IP advertised globally, routers pick the shortest path, withdrawal reroutes in milliseconds. Distinguish max-age from s-maxage, and when discussing flash crowds, name request collapsing and origin shielding as the thundering-herd antidote before touching the origin.

Key Trade-Offs

Edge caching absorbs 85-98% of traffic and cuts latency 40x, but global invalidation across hundreds of PoPs is slow, costly, and cache keys can go stale.

Related Curriculum Chapter

CDN Fundamentals & Anycast

Read Full Chapter Blueprint

Explore More Interactive Labs

View All 280 Labs