Caching Strategies Simulator — Interactive System Design Lab

Expire a hot cache key and watch every concurrent in-flight request miss at the same instant and hit the database together — a thundering herd. Compare a per-key lock (one request recomputes, the rest wait) against serving the stale value while a background job revalidates. Then look at the case that actually takes systems down: a cache warmed at deploy time where thousands of keys share one TTL, and see TTL jitter spread the expiries and flatten the spike. LRU (Least Recently Used) eviction — the pattern behind Redis and Memcached — is also here as a second scenario.

Expire a hot key and watch every in-flight request stampede the database at once — then fix it with a lock, stale-while-revalidate, and TTL jitter.

This free interactive simulation runs directly in your browser — no account needed. Adjust the parameters and watch how the system responds in real time.

Concepts covered

  • cache stampede
  • thundering herd
  • TTL jitter
  • caching
  • LRU
  • cache eviction
  • cache hit rate
  • Redis
  • Memcached
  • least recently used

Read the guide

  • Caching — The single most effective way to scale a system. Learn the patterns (Write-Through vs Write-Back), the Eviction policies, and the dangers of the Thundering Herd.

Related articles

  • How to Answer Any System Design Question — A step-by-step framework for tackling any system design interview question — requirements, estimation, high-level design, and deep dives — with a full worked example (Design a URL shortener) and the phrases interviewers listen for.
  • Top 10 System Design Interview Questions — The most frequently asked system design interview questions — URL shortener, rate limiter, key-value store, news feed, chat, and more — with the approach, key trade-offs, and follow-up questions interviewers actually ask for each one.