A hot key expires: stampede vs single-flight

A hot key expires: stampede vs single-flight A sequence diagram generated by Archify. GET product:42 ×1000 get ×1000 miss ×1000 same query ×1000 Database falls over GET product:42 ×1000 get stale value + refresh due 999 served stale, instantly one refresh (lock holder) set fresh value One query, not a thousand Unprotected Single-flight + stale value 1,000 requests · same key, same second · Sequence participant 1,000 requests same key, same second Service · cache-aside · Sequence participant Service cache-aside Cache · Redis · Sequence participant Cache Redis Database · source of truth · Sequence participant Database source of truth Legend main request return message