Cache stampede: the hot key problem

Cache hit rate 98 percent. The database still fell over. Both facts are true, and the second one does not care about the first. What happened. One key holds the result of a heavy query for the main page. TTL one minute. At some second the key expires. In that second a few hundred requests all get a miss, and all of them go to recompute the same heavy query. Redis is fine. MySQL is not. This is a cache stampede, and hit rate will not warn you, because hit rate is an average. The stampede lives in the worst second. ...

February 7, 2017 · 2 min · Murat Useinov