← Lessons

quiz vs the machine

Gold1350

System Design

The Cache Warming

Preloading hot data into the cache before traffic arrives to avoid a cold start.

4 min read · core · beat Gold to climb

The cold cache problem

When a cache starts empty, every early request misses and falls through to the database. This cold start can overload the backend and give users slow responses exactly when a service is launching or recovering.

What warming does

Cache warming proactively loads known hot data into the cache before or just after startup, so the first real requests find hits instead of misses.

Common strategies

  • Preload on startup by reading the most popular keys from the database.
  • Replay recent access logs to repopulate the previous hot set.
  • Shadow a fraction of live traffic to fill the cache before fully serving it.

Trade offs

  • Warming adds load to the database at the wrong moment if done too aggressively.
  • It needs a way to know which keys are actually hot, often from past access data.
  • After a deploy or failover, warming smooths the spike that an empty cache would cause.

Key idea

Cache warming preloads hot data so a fresh cache serves hits from the start, avoiding the backend overload of a cold cache under sudden traffic.

Check yourself

Answer to earn rating on the learn ladder.

1. What problem does cache warming address?

2. Which is a common cache warming strategy?