A cache stampede hits your origin when a popular object expires. How do you protect the origin?
AdvancedScenarioLoad Balancing, Proxies & CDN
Answer
Situation read → Many edge nodes request the same object simultaneously on a miss.
What I'd do →
- Enable origin shield (CloudFront) or a regional cache layer to collapse requests
- Use request collapsing and
stale-while-revalidate/stale-if-errorheaders - Add jitter to TTLs so objects don't expire together
- Rate-limit and autoscale the origin
- Pre-warm important URLs after deploy
Why → Collapsing concurrent misses into one origin fetch turns a thundering herd into a single request.
Interview tip → Mention stale-if-error as a cheap availability feature.
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?BeginnerWhat does a CDN do and when does it help?Beginner