Patterns

Cache warming and tiered caching

Fill a cache before it takes traffic, and put a second cache between the first and the origin, so a cold or distant cache does not send every read to the source.

Warming fills a cache ahead of demand, and tiering lets a miss ask a nearby cache before it asks the origin.

Use it when#

  • A cache restart or a deploy leaves the database overloaded for minutes.

  • Many CDN edges miss the same large file and each fetches it from your origin.

  • You know what will be hot before it is requested, such as a launch page.

How it works#

Warming replays recent or popular keys into the cache before it receives users. Tools do this by reading a key list from the database, or by loading a snapshot, as Redis does when it reloads its data file after a restart.

Tiering adds a layer. A CDN edge that misses asks a regional cache, and only that cache calls the origin. Ten edges missing the same video cost the origin one fetch, not ten. Cloudflare and Fastly both sell this as a shield or tiered cache.

What it costs#

Warming takes time and database reads of its own, so a warm-up run during peak hours can cause the load it was meant to prevent. A stale key list warms the wrong data. Tiering adds a hop on a miss and one more cache to purge, so a purge that reaches only the edge leaves old content in the regional tier.

In Quorum#

Warming is a switch on the Cache, and it needs Cache warming, which in turn needs Stampede protection. Tiered caching is a CDN effect with no switch: Tiered caching makes edges ask a regional tier for video, and the Design lists it as a research it needs.

Drag to pan. Hold Ctrl or Cmd and scroll to zoom.

At 2.00k Users the Simulation solves this Design to Apdex 1.00, p99 120 ms, 0.0% errors and $4.46/s Burn, of which $0.02/s is egress.
WhereSettingValueWhy
App ServerInstance sizesmallSmall gives the app two vCPUs, enough to run code while the data tier does its own work.
CacheWarmingOnAfter a restart the Cache refills from the Database before it takes traffic, so a restart does not send every read through at once.
CacheCoalesce missesOnWarming needs Stampede protection first, and coalescing covers the misses that arrive while the Cache is still filling.
CacheInstance sizesmallMemory decides how much of the hot set fits. A Cache too small for it misses even on popular rows.
DatabaseInstance sizesmallSmall gives the Database two vCPUs, so the figures below reflect the Cache and not a starved Database.

Research this Design needs: Content delivery, Caching, Checkout, Stampede protection, Cache warming, Tiered caching.

The Cache stampede incident is what warming prevents. The glossary defines cache warming and tiered caching.