Caching Strategies & In-Memory Optimization Questions
Designing cache layers to cut redundant work and speed up reads, and the correctness costs that come with them. Covers cache placement (client/CDN/application/in-memory store), eviction policies, TTLs, write-through vs write-back, warming, and invalidation. Emphasizes hit-rate reasoning and the staleness/consistency trade-offs caching introduces.
You operate a monorepo build system that produces hashed assets on every deploy and you want to avoid 503s or missing asset errors when the CDN or browser requests new hashed assets before they are fully warmed. Propose a cache warm-up strategy, including steps to pre-populate CDN caches, avoid cache fragmentation, and methods to gracefully serve requests during a short warm-up window.
Show an example webpack configuration snippet (or equivalent bundler) that implements asset fingerprinting for cache busting and explains how to configure the server or CDN to serve those immutable assets with long max-age headers while keeping HTML responses short-lived.
Write a service worker fetch handler (in JavaScript) that applies a stale-while-revalidate strategy for static assets under '/static/' and a network-first strategy with a short timeout for API requests under '/api/'. The handler should update caches appropriately and avoid blocking the response while updating caches.
Explain code splitting for single-page applications: what it is, why it improves perceived performance, and two approaches (for example, route-based splitting and vendor splitting). For each approach explain one scenario where it is most beneficial.
In a React application, show how you would implement code splitting and lazy loading for route-based bundles using React.lazy and Suspense. Explain how you would verify chunking and ensure that vendors are split from application code in a webpack configuration.
Unlock Full Question Bank
Get access to all 35 Caching Strategies & In-Memory Optimization interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.