Content Delivery Networks
A CDN is a globally distributed network of edge servers that cache content close to users. Instead of every request crossing the world to your origin server, a user in Tokyo hits a CDN node in Tokyo and gets a cached response in milliseconds. This reduces latency for static assets and offloads traffic from your origin.
Modern CDNs do more than cache files. Edge compute (Cloudflare Workers, Lambda@Edge, Vercel Edge Functions) runs code at CDN nodes — A/B testing, authentication, personalisation — without a round trip to origin. Dynamic content can be cached at the edge too using short TTLs and stale-while-revalidate: serve the cached version instantly, refresh it in the background.
Check your understanding
What does a CDN primarily optimize?Show answerHide answer
Answer
Latency and origin load by serving cached content from edge locations closer to users — for cacheable responses.What should usually not be cached at the shared CDN edge?Show answerHide answer
Answer
User-specific private responses (my orders, my session) unless carefully varied and authorized.What does stale-while-revalidate do?Show answerHide answer
Answer
Serve a cached response immediately while refreshing in the background within policy limits.