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.

EasyTechnical
0 practiced
Implement an LRU (Least Recently Used) cache in Python with the following API:
class LRUCache: def __init__(self, capacity: int): pass def get(self, key: int) -> int: # returns value or -1 if missing pass def put(self, key: int, value: int) -> None: pass
Requirements: get and put must be O(1). Evict the least recently used item when capacity is exceeded. Show a short usage example and explain any assumptions you make (e.g., single-threaded). You may use built-in data structures but avoid using collections.OrderedDict if you want to implement from first principles.
MediumTechnical
0 practiced
Design an observability/telemetry stack specifically for caching: what logs, metrics, traces and sampling strategy would you collect? Include examples of key dashboard panels (hit/miss heatmap, per-key latency percentiles, eviction trends) and how you'd use traces to root-cause tail latency that appears in cached requests.
HardSystem Design
0 practiced
Design a multi-tenant caching strategy to prevent a noisy tenant from evicting others in a shared Redis cluster. Discuss approaches: key namespacing, per-tenant quotas, client-side caches, separate DB IDs, and eviction isolation. Outline how you'd enforce quotas and monitor for cross-tenant interference.
MediumTechnical
0 practiced
You operate a Redis cluster. Describe how you would size memory, tune maxmemory-policy, and manage memory fragmentation for a workload with lots of short-lived keys and some large value objects. Explain trade-offs between volatile-ttl, allkeys-lru, and noeviction policies and their impact on application behavior.
MediumTechnical
0 practiced
Compare TTL-based invalidation vs versioned (key-version) invalidation. Describe pros and cons for each and give examples of when you'd prefer versioned keys (fast invalidation) and when TTLs are simpler and more appropriate. Discuss storage overhead and key cleanup considerations.

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.