Cloudflare: 20% of the Internet in 300 Cities
Cloudflare's network spans 300+ cities in 100+ countries, serving over 20% of all internet traffic. But modern CDN nodes are not just caching static files anymore. Cloudflare Workers run full JavaScript applications at every edge node - meaning your code executes within 50ms of every internet user on Earth. The CDN has evolved from a passive cache to a globally distributed compute platform. This shift - from 'store files closer to users' to 'run code closer to users' - is fundamentally changing how we architect applications.
CDN Evolution
Three Generations of CDN:
Gen 1 (1990s-2010s): Static File Cache
Origin -> CDN Nodes -> User
Cache: images, CSS, JS bundles
Latency: 5-30ms (edge) vs 200ms (origin)
Intelligence: none - just serve cached bytes
Gen 2 (2010s-2020): Dynamic Acceleration
+ TLS termination at edge (save 1 RTT)
+ TCP connection pooling to origin
+ DDoS mitigation at edge
+ Intelligent routing (fastest path to origin)
Intelligence: network optimization
Gen 3 (2020+): Edge Compute Platform
+ Full application code at edge nodes
+ Key-value storage at edge (KV)
+ Stateful objects at edge (Durable Objects)
+ SQL databases at edge (D1, Turso)
Intelligence: full application logic
Platforms:
- Cloudflare Workers (V8 isolates, <1ms cold start)
- AWS Lambda@Edge (Node.js/Python, ~50ms cold start)
- Vercel Edge Functions (built on Workers)
- Deno Deploy (Deno runtime at edge)
- Fastly Compute@Edge (Wasm, <1ms cold start)Edge-First Architecture
What You Can Do at the Edge Today:
Use Case Without Edge With Edge
------------------- ------------------- -------------------
Auth (JWT verify) 200ms round-trip 5ms at edge
to origin server No origin needed
A/B testing Origin decides Edge rewrites URL
which variant before request
reaches origin
Personalization Origin renders Edge assembles from
per-user page cached fragments
API composition Client makes 3 Edge fetches 3 APIs
serial requests in parallel, returns 1
Bot mitigation Origin processes Edge blocks before
+ rejects bots bots reach origin
Geolocation Origin looks up IP Edge knows location
in database inherently (it IS local)
Edge-first pattern:
Request -> [Edge] -> Serve from cache? YES -> done (0 origin)
-> Need auth? Verify JWT at edge
-> Need dynamic data? Fetch from origin
-> Assemble response at edge -> User
Result: 70-90% of requests never reach originInterview Tip
Modern CDN design goes beyond 'cache static files at edge nodes.' Show you understand the evolution: Gen 1 (static cache), Gen 2 (TLS/TCP optimization), Gen 3 (full compute at edge). The key architecture pattern: handle authentication, A/B testing, and bot filtering at the edge so 70-90% of requests never hit your origin. Mention Cloudflare Workers or Lambda@Edge by name. The edge trade-off: limited compute time (10-50ms CPU limits) and eventual consistency for edge state.
