← Databricks Interview Insights

Databricks·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
May 2026

Summary

Databricks system design round, single question but it ran the full hour. They wanted a deep dive on an in-process cache with LRU eviction, concurrency, and optional durability. More involved than I expected for what sounded like a straightforward caching problem.

Questions Asked (1)

Q1

Design a single-machine in-memory cache for a web service that supports Get, Put, and Delete operations with LRU eviction and optional durability across restarts.

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

Started fine with the hashmap plus doubly-linked list combo for LRU, but the concurrency part is where I started fumbling.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (read/write ratio, latency, durability guarantees, memory constraints) and then design the core in-memory cache using a hash map and doubly linked list for O(1) Get/Put/Delete with LRU eviction. Discuss optional durability by considering write-ahead logging or snapshotting, and evaluate trade-offs between performance, consistency, and recovery time.

Pro tip: Emphasize that durability is optional and should be configurable; propose a pluggable persistence layer (e.g., WAL for write-heavy or snapshots for read-heavy) and discuss how to handle cache warm-up after restart to avoid thundering herd.

1. Clarify Requirements and Constraints

Ask about expected throughput, latency, memory limits, durability needs, and consistency requirements to scope the design appropriately.

2. Design Core In-Memory Data Structures

Propose a hash map for O(1) key lookup and a doubly linked list to track access order, enabling O(1) LRU eviction and updates.

3. Implement LRU Eviction and Concurrency

Explain how to evict the least recently used item when capacity is reached, and discuss thread-safety using fine-grained locking or lock-free techniques.

4. Add Optional Durability

Describe persistence options like write-ahead logging (WAL) or periodic snapshots, and how to recover state on restart while balancing performance and durability.

5. Discuss Trade-offs and Optimizations

Compare durability approaches, eviction policies, and concurrency models; mention potential optimizations like segmented LRU or TTL support.

Key Points to Mention

  • O(1) operations using hash map + doubly linked list
  • LRU eviction policy and implementation details
  • Thread-safety and concurrency control (e.g., read-write locks, sharding)
  • Durability options: write-ahead logging vs. snapshotting
  • Trade-offs: performance vs. durability, memory overhead, recovery time
  • Cache warm-up strategies and handling cold starts

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.