A Lagos news site where every breaking story crashed the origin
When a big story dropped, traffic spiked 30x in minutes. The article page cached for 60 seconds — but at expiry, thousands of simultaneous requests all missed at once and stampeded the origin. The PHP backend tipped over, and readers got 502s exactly when the story mattered most.
The TTL wasn't wrong. The thundering herd was.
What we changed: enabled stale-while-revalidate with a 30s fresh window and a 24h stale window, plus origin request coalescing so only one request per object revalidated while everyone else got the cached copy instantly.
During the next major story, origin requests-per-second peaked at 9 instead of an estimated 4,000. Readers saw content in 40ms with zero 502s. The backend never crossed 20% CPU.
The number that mattered: origin RPS capped at 9 during a 30x spike.
Edge of Glory
@EdgeOfGloryCDN
A Lagos news site where every breaking story crashed the origin
Этот пост опубликован в Telegram-канале Edge of Glory. Подписаться можно по ссылке: @EdgeOfGloryCDN.