Repaso
Español
System DesignAdvancedSD-06

A popular cache key expires and thousands of requests hit the DB at once. This is…

Options

  1. Cache stampede (thundering herd) (Correct option)
  2. Split brain between two nodes
  3. Hot partition on one shard
  4. Replication lag on a read replica

Answer

Cache stampede (thundering herd)

Why

While the key was cached, the database was protected. The moment it expires, every request misses at the same time and all of them query the database to rebuild the same value, which can overload it.

Fixes: let only one request rebuild it (a lock) while others wait or get the old value; refresh shortly before expiry; add random jitter to TTLs so keys don't all expire together.

Remember

Many misses at once on a hot key = cache stampede.

Key terms

Practice this question in Repaso