Millions of prices change at midnight. Nothing expires.
transcript
Midnight. Every sale price goes live at once. And 6.3 million people are on the app in the same minute.
In 2014, Flipkart deployed nearly 5,000 servers for its first big sale. It prepared for 20 times the traffic. Traffic was still much higher.
The easy way? Set every cached price to expire at midnight. Then every miss hits the price service. In the same second. A cold cache at midnight is an outage.
So make the sale a version. Before midnight, stage version 42. New keys. Pushed to every cache and the CDN. Version 41 stays live. Nothing is overwritten. At 12:00:00, one pointer moves. 41 to 42. Nothing expires. Nothing is recomputed.
But here's the catch. Six million phones still refresh at midnight. So the app downloads the sale's assets hours ahead. And it waits zero to three random seconds before its first refresh. So they don't all ask in the same 100 milliseconds.
Never let caches expire at your busiest second. Load the new version early. Then flip one pointer.
Full breakdown in the lecture.