InterviewStack.io LogoInterviewStack.io

Caching and Performance Optimization Questions

Covers design and implementation of multi layer caching and end to end performance strategies for web and backend systems. Topics include client side techniques such as browser caching, service worker strategies, code splitting, and lazy loading for components images and data; edge and distribution techniques such as content delivery network design and caching of static assets; and server side and data layer caching using in memory stores such as Redis and Memcached, query result caching, and database caching patterns. Includes cache invalidation and coherence strategies such as time to live, least recently used eviction, cache aside, write through and write behind, and prevention of cache stampedes. Covers when to introduce caching and when not to, performance and consistency trade offs, connection pooling, monitoring and metrics, establishing performance budgets, and operational considerations such as cache warm up and invalidation during deploys. Also addresses higher level concerns including search engine optimization implications and server side rendering trade offs, and how performance decisions map to user experience and business metrics at senior levels.

HardTechnical
27 practiced
You run Node.js servers that make many short Redis requests. Discuss connection pooling and concurrency strategies to minimize file-descriptor exhaustion and latency: consider single shared connection with pipelining, per-thread/process pools, TLS overhead, and client libraries (ioredis). Show how you'd calculate an appropriate pool size given QPS and average command latency.
EasyTechnical
29 practiced
What is a Content Delivery Network (CDN)? Explain how CDNs reduce latency and origin load, and list typical edge caching behaviors (respecting Cache-Control, TTL, stale-while-revalidate). Give one concrete example where CDN caching is inappropriate and explain why.
MediumTechnical
30 practiced
In JavaScript, write a concise Service Worker fetch handler that implements a 'stale-while-revalidate' strategy for images: return cached image if present, kick off a background fetch to update the cache, and on cache miss fetch from network and store in cache. Use async/await, Cache API, and include a cache name constant and a TTL comment.
EasyTechnical
37 practiced
Define the cache-aside pattern and contrast it with write-through and write-behind strategies. For each pattern, explain the read and write flow, typical TTL/invalidation approach, and the primary consistency and durability trade-offs.
HardTechnical
35 practiced
You must prevent a cache stampede on a computationally expensive key at 10k QPS. Design and provide pseudocode for a distributed request coalescing (singleflight) mechanism that deduplicates concurrent fetches across processes using Redis. Ensure it supports timeouts and failure paths where waiting clients receive a fallback or stale data.

Unlock Full Question Bank

Get access to hundreds of Caching and Performance Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.