Interview prompt
Explain caching and routing change the request path to an engineer who understands the surrounding system but has not used this technique. Walk from its contract to a concrete operation, then discuss where it fails or becomes expensive.
A strong answer
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 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.
A complete answer also calls out the assumptions that control correctness. 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.
Close by describing one representative test or measurement. 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.
Follow-up questions
Answer the follow-ups in the frontmatter. Use the linked article for the concept and the trace to make the explanation concrete.