PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Netflix

Plan Eviction and Cleanup for a Production Cache

Last updated: Jul 15, 2026

Quick Overview

Turn a process-local timed cache into a production-ready component with bounded memory and request latency. Compare eviction and admission policies, coordinate expiration cleanup under concurrency, and cover distributed scaling, overload behavior, testing, and operational metrics.

  • medium
  • Netflix
  • Software Engineering Fundamentals
  • Software Engineer

Plan Eviction and Cleanup for a Production Cache

Company: Netflix

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

# Plan Eviction and Cleanup for a Production Cache A process-local timed cache is correct for basic puts and gets, but it can still exhaust memory, retain expired bookkeeping, or behave poorly under concurrency. Explain how you would turn it into a production-ready component. ### Constraints & Assumptions - Practice assumption: entries have heterogeneous sizes and TTLs, and the process has a hard memory budget. - Workload popularity can be skewed and can change over time. - Callers need bounded latency; a full-cache scan on an ordinary request is unacceptable. - The discussion should distinguish a single-process cache from a distributed cache service. ### Clarifying Questions to Ask - Is the limit a key count, an estimated byte budget, or both? - Does a stale entry need to disappear immediately, or only become unreadable immediately? - Are values recomputable, and is stale data ever acceptable? - What hit-rate, latency, and durability expectations matter? ### Part 1: Eviction and Out-of-Memory Control Compare suitable eviction policies, choose a default for the stated workload, and explain how you prevent the process from crossing its memory limit. #### Hints - Think about both admission and eviction. - Consider whether one unusually large value should displace many useful small values. #### What This Part Should Cover - A justified policy choice - Memory accounting and overload behavior - Workload-dependent trade-offs ### Part 2: Expiration Cleanup and Concurrency Describe lazy and proactive expiration cleanup, and explain how reads, writes, and cleanup coordinate without corrupting state. #### Hints - Immediate logical expiration and physical reclamation do not have to happen in the same operation. #### What This Part Should Cover - Bounded cleanup work - Synchronization boundaries - Race handling around expiration and replacement ### Part 3: Scale, Testing, and Operations Explain what changes if the cache becomes a shared service, and identify the tests and production signals you would require. #### Hints - Include failure behavior, not only the healthy path. #### What This Part Should Cover - Ownership or partitioning strategy - Correctness and load tests - Metrics that expose memory and hit-rate regressions ### What a Strong Answer Covers - Clear semantics before implementation choices - A policy tied to workload and memory constraints - Bounded request-path work and explicit concurrency control - Operational limits, degradation behavior, and measurable validation ### Follow-up Questions - How would you prevent many callers from recomputing the same expired key? - When would TinyLFU-style admission be preferable to plain LRU? - How would you roll out a new eviction policy without risking a fleet-wide miss storm?

Quick Answer: Turn a process-local timed cache into a production-ready component with bounded memory and request latency. Compare eviction and admission policies, coordinate expiration cleanup under concurrency, and cover distributed scaling, overload behavior, testing, and operational metrics.

Related Interview Questions

  • Model Direct-Sold DSP Orders - Netflix (medium)
  • Design demand-side ads relational tables - Netflix (hard)
  • Design a concurrent latency percentile tracker - Netflix (hard)
  • Explain concurrency and reliability tradeoffs - Netflix (hard)
  • Design a thread-safe key-value store - Netflix (medium)
|Home/Software Engineering Fundamentals/Netflix

Plan Eviction and Cleanup for a Production Cache

Netflix logo
Netflix
Jul 11, 2026, 12:00 AM
mediumSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
1
0

Plan Eviction and Cleanup for a Production Cache

A process-local timed cache is correct for basic puts and gets, but it can still exhaust memory, retain expired bookkeeping, or behave poorly under concurrency. Explain how you would turn it into a production-ready component.

Constraints & Assumptions

  • Practice assumption: entries have heterogeneous sizes and TTLs, and the process has a hard memory budget.
  • Workload popularity can be skewed and can change over time.
  • Callers need bounded latency; a full-cache scan on an ordinary request is unacceptable.
  • The discussion should distinguish a single-process cache from a distributed cache service.

Clarifying Questions to Ask

  • Is the limit a key count, an estimated byte budget, or both?
  • Does a stale entry need to disappear immediately, or only become unreadable immediately?
  • Are values recomputable, and is stale data ever acceptable?
  • What hit-rate, latency, and durability expectations matter?

Part 1: Eviction and Out-of-Memory Control

Compare suitable eviction policies, choose a default for the stated workload, and explain how you prevent the process from crossing its memory limit.

Hints

  • Think about both admission and eviction.
  • Consider whether one unusually large value should displace many useful small values.

What This Part Should Cover

  • A justified policy choice
  • Memory accounting and overload behavior
  • Workload-dependent trade-offs

Part 2: Expiration Cleanup and Concurrency

Describe lazy and proactive expiration cleanup, and explain how reads, writes, and cleanup coordinate without corrupting state.

Hints

  • Immediate logical expiration and physical reclamation do not have to happen in the same operation.

What This Part Should Cover

  • Bounded cleanup work
  • Synchronization boundaries
  • Race handling around expiration and replacement

Part 3: Scale, Testing, and Operations

Explain what changes if the cache becomes a shared service, and identify the tests and production signals you would require.

Hints

  • Include failure behavior, not only the healthy path.

What This Part Should Cover

  • Ownership or partitioning strategy
  • Correctness and load tests
  • Metrics that expose memory and hit-rate regressions

What a Strong Answer Covers

  • Clear semantics before implementation choices
  • A policy tied to workload and memory constraints
  • Bounded request-path work and explicit concurrency control
  • Operational limits, degradation behavior, and measurable validation

Follow-up Questions

  • How would you prevent many callers from recomputing the same expired key?
  • When would TinyLFU-style admission be preferable to plain LRU?
  • How would you roll out a new eviction policy without risking a fleet-wide miss storm?
Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Netflix•More Software Engineer•Netflix Software Engineer•Netflix Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.