Browse patterns / Service architecture / B013
cache aside

Cache-aside

A pattern that loads data into the cache from the data store on demand.

Recorded evidence 13/14Compare →Source
01 / UNDERSTAND

Structure and behavior

Follow the arrows step by step.

On a cache miss, read the source and populate the cache. Define expiry (TTL), refresh, and invalidation policies.

Expected benefits

Reduces latency and contention in the source data store and improves concurrent request handling.

Trade-offs

Dual writes to cache and data store can diverge and may require retries and reconciliation logic.

Not a fit if strong consistency is required, writes are frequently followed by immediate reads, or cache misses are costly.

02 / APPLY

Operations and adoption guide

Synthesis, distinct from items backed by source excerpts. Validate before applying in production.

When to use

Use for read-heavy data with many repeated lookups and tolerance for brief staleness, such as product catalogs, user profiles, or API responses.

Scenario

A large e-commerce or supply-chain platform serves 100 million reads and 50,000 writes per day. It targets P95 product and inventory lookup latency below 100 ms and at least 70% lower source DB load. On a miss the application reads the DB and populates Redis with a TTL, then invalidates cached stock levels on inventory changes. Up to five minutes of stale price or stock display is acceptable, but checkout uses authoritative DB values.

Placement principles

  • Keep the cache-aside lookup logic with the application and put shared Redis between it and the source database
  • Place static public data at the edge CDN and user or domain data in the application cache
  • Keep the source DB authoritative and manage cache TTLs and invalidation
  • In Kubernetes, separate the app Deployment, Redis StatefulSet or Operator or managed cache, and CloudNativePG or managed RDB
  • Isolate hot keys and large keys with a separate cache tier or sharding.

On premises

Run Redis HA with Sentinel or Cluster and separate latency paths and fault domains among the app, cache, and DB. Tune connection pools, timeouts, and circuit breakers for miss storms, and standardize invalidation, retries, and monitoring.

03 / VERIFY

Evidence by criterion (14 total)

Evidence availability at the time of research. Assess source accuracy and currency separately.

Definition and overviewEvidence available

A pattern that loads data into the cache from the data store on demand.

Load data on demand into a cache from a data store.

learn.microsoft.com original ↗

Problem addressedEvidence available

Reduces P95 latency and load on the database when read-heavy workloads repeatedly request the same records.

Primary databases optimized for durability pay the full cost of a disk-based lookup on every request; as traffic grows, P95 latency degrades

redis.io original ↗

Key components and resourcesEvidence available

The application manages access to the cache and the source data store.

Cache-Aside uses a cache alongside the source data store, with the application managing access to both.

www.makonea.com original ↗

Data and asset placementEvidence available

Put an edge CDN ahead of the read-optimized web tier, the application cache-aside layer next, and the database behind it.

A read-optimized web tier fronts the database with an edge CDN and application cache-aside layer.

freeaidiagram.com original ↗

Typical use casesEvidence available

Useful for workloads with repeated reads, such as product catalogs, user profiles, and API responses.

Read-heavy workloads (product catalogs, user profiles, API responses) hit the same records thousands of times between updates.

redis.io original ↗

Example scenarioEvidence available

Example: a web architecture optimized for reads in a supply-chain and planning platform.

Design a Kubernetes architecture for a Supply Chain & Planning platform using the Cache-Aside Read-Heavy Web pattern.

freeaidiagram.com original ↗

When to avoid and caveatsEvidence available

Not a fit if strong consistency is required, writes are frequently followed by immediate reads, or cache misses are costly.

You need strong consistency between cache and database

redis.antirez.com original ↗

On premises: development, deployment, and operationsUnverified

No primary-source evidence was recorded. This does not imply that the pattern is unsuitable.

Cloud: development, deployment, and operationsEvidence available

Misconfigured clients can cause recurring managed cloud cache outages. Validate settings, retries, and timeouts.

a small number of client-side misconfigurations in how applications connected to ElastiCache were causing repeated disruptions.

aws.amazon.com original ↗

Kubernetes: development, deployment, and operationsEvidence available

In Kubernetes, run the cache-aside application as a Deployment and combine it with Redis, a database, and Ingress or a CDN.

Design a Kubernetes architecture for a Supply Chain & Planning platform using the Cache-Aside Read-Heavy Web pattern.

freeaidiagram.com original ↗

Incident responseEvidence available

If the Redis connection fails, fall back transparently to the database instead of returning a user-facing error.

If the Redis connection fails, the application must transparently fall back to the database instead of returning an error to the user.

www.mironsoft.de original ↗

BenefitsEvidence available

Reduces latency and contention in the source data store and improves concurrent request handling.

Caching reduces the latency and contention that are associated with handling large volumes of concurrent requests in the original data store.

learn.microsoft.com original ↗

Drawbacks and trade-offsEvidence available

Dual writes to cache and data store can diverge and may require retries and reconciliation logic.

Imagine that you’ve successfully updated the cache but the datastore fails to update. The code needs to implement retries.

hazelcast.com original ↗

Representative tools and technologiesEvidence available

Redis is a representative in-memory cache.

Redis In-memory cache

freeaidiagram.com original ↗

Additional references (23)