The Runtime Theory
mediumSystemInternals#explain-the-model#reason-about-tradeoffs

Explain Caching and Routing Change the Request Path

Explain the model, execution steps, complexity, and limits of caching and routing change the request path.

TRT practice prompt — not a verified question from a named employer.

The Runtime Theory Team6 min read

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.

This answer walks

Practice follow-ups

  1. 01Which assumption is essential for the approach to be correct?
  2. 02What is the worst case, and how does it change the resource cost?
  3. 03How would you adapt the design if the input or workload became much larger?
  4. 04What boundary test would give you the most confidence in the implementation?

One dispatch a week

The trace behind each question, the tradeoff that explains it, and one technical dispatch per week — no noise.

One technical dispatch per week. No noise.

Not started

Sign in to save your learning progress.

Sign in to save