← Databricks Interview Insights

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

SeniorPrefer not to say
May 2026

Summary

Databricks system design round, one big question that took the full hour. The scope was genuinely wide and I kept second-guessing whether to go deep on one piece or keep moving. Not sure how I did.

Questions Asked (1)

Q1

Design a high-throughput client-side file cache that serves ranged reads from a remote storage service. The remote API lets you fetch by filename with byte offset and length, or download an entire file. Cover chunk sizing, request coalescing, prefetching, thread safety, deduplication of in-flight downloads, backpressure, eviction (LRU or similar), cache persistence, handling remote file changes, partial failures, retries, and timeouts. Define your read API and write policy, provide key data structures and pseudocode, and analyze correctness under concurrency plus time/space complexity.

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

This one sprawled in every direction and I struggled to pick a thread.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and defining the read API and write policy, then design the cache with chunk-based storage, in-flight deduplication, and LRU eviction. Walk through concurrency, failure handling, and complexity, emphasizing trade-offs and Databricks-relevant optimizations like prefetching and backpressure.

Pro tip: Explicitly discuss how you would handle remote file changes using versioning or ETags, and how to avoid cache poisoning during partial failures—this shows production maturity beyond textbook caching.

1. Clarify Requirements and Define API

Ask about read patterns, file sizes, consistency needs, and latency goals. Define the read API (e.g., read(filename, offset, length)) and write policy (write-through or write-back, with chunk granularity).

2. Design Core Data Structures and Chunking

Choose a chunk size (e.g., 1-4 MB) balancing overhead and parallelism. Use a hash map from filename to file metadata (size, version, chunk map) and an LRU list for eviction. Store chunks in a concurrent map with reference counting.

3. Handle Concurrency and Deduplication

Use a concurrent map of in-flight downloads keyed by filename+chunk to deduplicate requests. Implement thread-safe reads with read-write locks or lock-free structures, and ensure atomic updates to chunk state.

4. Implement Prefetching, Backpressure, and Failure Handling

Prefetch sequential chunks based on access patterns, apply backpressure via bounded queues or semaphores, and handle partial failures with retries, timeouts, and fallback to full-file download if needed.

5. Analyze Correctness and Complexity

Prove correctness under concurrency (e.g., linearizability of reads, no duplicate downloads), and analyze time/space complexity (O(1) average for chunk access, O(N) for eviction). Discuss persistence and remote change detection.

Key Points to Mention

  • Chunk sizing trade-offs: smaller chunks for parallelism vs. larger chunks for reduced overhead; consider fixed vs. variable chunking.
  • Request coalescing and deduplication: use a concurrent map of in-flight promises/futures to avoid duplicate remote fetches.
  • Eviction policy: LRU with reference counting to avoid evicting chunks in use; consider segmented LRU for scan resistance.
  • Backpressure: bounded queues or semaphores to limit concurrent downloads and prevent memory exhaustion.
  • Remote file changes: use versioning (ETags, last-modified) to invalidate stale chunks; handle partial failures with retries and timeouts.
  • Persistence: write chunks to disk with metadata, and recover cache state on restart; consider write-ahead logging for crash consistency.

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