What does a CDN do and when does it help?
BeginnerScenarioLoad Balancing, Proxies & CDN
Answer
Situation read → A CDN caches content at edge locations close to users.
What I'd do →
- Static assets (images, JS, CSS, video) are cached at the edge and served without touching the origin
- Cache hits cut latency and origin load
- Set
Cache-Control: public, max-age=31536000, immutableon hashed assets - Dynamic content can still benefit from edge TLS termination and persistent origin connections
- Check with
curl -sI https://cdn.example.com/app.js | grep -i x-cache
Why → The speed of light is the real bottleneck for global users, and a nearby cache removes the round trip.
Interview tip → Mention cache keys, since mistakes there cause cache misses or wrong content for other users.
More on Load Balancing, Proxies & CDN
What is the difference between a Layer 4 and a Layer 7 load balancer?BeginnerWhen do you choose an ALB and when an NLB in AWS?BeginnerForward proxy versus reverse proxy: what is the difference?BeginnerHow do health checks work on a load balancer and what makes a good one?BeginnerWhat are sticky sessions and why would you avoid them?BeginnerYour app sees the load balancer's IP instead of the real client IP. How do you get the real one?Beginner