The Runtime Theory
Caching and Routing

Caching and Routing Change the Request Path

A cache stores reusable results near the request path to reduce repeated work or latency.

The Runtime Theory Team5 min read#caching#load-balancing#consistency
▸ On this page

The model

A cache stores reusable results near the request path to reduce repeated work or latency. Routing decides which server or shard handles a request. Together they affect freshness, locality, load distribution, and which layer is responsible for serving a particular version of data.

A concrete walk-through

A cache-aside flow checks the cache, loads from the source on a miss, then stores the result with an expiry. A load balancer can distribute new connections among healthy backends, while consistent hashing can reduce key movement when a cache node changes.

Costs and failure cases

Invalidation is difficult because writes and cache fills can race. Sticky routing may improve locality but make failover and uneven load harder. Cache keys must include every input that changes the result, especially tenant, locale, authorization, and version context.

Check your understanding

A user updates a profile and immediately sees stale data from a cache. Compare expiry-only, explicit invalidation, and versioned cache keys for this consistency requirement.

Further reading

AWS Well-Architected Framework

Not started

Sign in to save your learning progress.

Sign in to save