← Databricks Interview Insights

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

SeniorPrefer not to say
Jul 2026

Summary

System design round at Databricks for a software engineer role, focused entirely on building a durable key-value store from scratch. The depth they expected was pretty intense, covering everything from WAL design to concurrency models to back-of-envelope math. Left feeling like I'd been wrung out.

Questions Asked (7)

Q1

Design a durable key-value store with put, get, and delete operations. Walk through how you'd use a write-ahead log to guarantee durability, lay out your on-disk data structures, and explain how the system recovers after a crash.

System DesignTechnical Trade-offs
Author's notes

This was the core of the whole interview and it ate up most of the time.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (durability, consistency, scale) and then present a high-level design of a log-structured key-value store. Walk through the write path (WAL + memtable), read path (memtable + SSTables), and crash recovery (replay WAL). Emphasize trade-offs between performance and durability, and how the design ensures data integrity.

Pro tip: Mention that you would periodically checkpoint the memtable to SSTables and truncate the WAL to avoid unbounded log growth, and discuss how to handle partial writes using checksums or length-prefixed records.

1. Clarify Requirements and Assumptions

Ask about expected workload (read/write ratio, key/value sizes), durability guarantees (fsync per write?), and scale. State assumptions to scope the design.

2. High-Level Architecture

Describe the components: WAL, memtable (in-memory sorted structure), SSTables (immutable on-disk sorted files), and a background compaction process. Explain how they interact.

3. Write Path and Durability

Detail the write operation: append to WAL (with fsync for durability), then update memtable. Explain how this guarantees durability even if the system crashes before flushing to disk.

4. Read Path and Deletes

Explain how reads check memtable first, then SSTables (using bloom filters and sparse indexes). Describe how deletes are handled via tombstones and compaction.

5. Crash Recovery and Compaction

Walk through recovery: replay WAL to rebuild memtable, then flush to SSTable. Discuss compaction to merge SSTables, remove tombstones, and manage disk space.

Key Points to Mention

  • Write-ahead log (WAL) ensures durability by persisting writes before applying to memtable.
  • Memtable is an in-memory sorted data structure (e.g., balanced tree or skip list) for fast writes and reads.
  • SSTables are immutable, sorted string tables on disk, often with bloom filters and sparse indexes for efficient lookups.
  • Crash recovery involves replaying the WAL to reconstruct the memtable, then flushing it to disk.
  • Compaction merges SSTables, removes obsolete data (including tombstones), and maintains read performance.
  • Trade-offs: fsync frequency vs. write latency, compaction strategy (size-tiered vs. leveled) vs. read/write amplification.

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

Q2

How would you handle torn writes in your WAL, and what's your fsync and batching strategy?

System DesignTechnical Trade-offs
Author's notes

Follow-up to the main design question.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the problem of torn writes in WAL and the need for atomicity and durability. Then describe a concrete strategy using checksums, write-ahead logging, and recovery mechanisms, and discuss fsync batching trade-offs between latency and throughput. Finally, tie it back to Databricks' use cases like Delta Lake.

Pro tip: Mention that you'd measure and tune fsync batching based on workload characteristics, and that you'd consider using O_DIRECT or fdatasync to reduce overhead. Also, highlight the importance of idempotent recovery and testing with fault injection.

1. Define the problem

Explain what torn writes are: partial writes due to crashes or power loss, leading to corrupted WAL records. Emphasize the need for atomicity and durability.

2. Detection and prevention

Describe using checksums (e.g., CRC32) per record or block to detect torn writes. Mention writing records with length and checksum, and possibly padding to sector size to avoid partial sector writes.

3. Recovery strategy

Outline recovery: on startup, scan WAL from last checkpoint, validate checksums, and truncate at first invalid record. Ensure idempotent replay and possibly use a separate manifest or double-write buffer.

4. fsync and batching

Discuss fsync strategies: group commit to batch multiple transactions into one fsync, trading latency for throughput. Mention using fdatasync if metadata not needed, and tuning batch size based on workload.

5. Trade-offs and optimizations

Talk about trade-offs: durability vs performance, fsync frequency, and using async I/O or O_DIRECT. Mention monitoring and adapting batching dynamically.

Key Points to Mention

  • Checksums (CRC) for detecting torn writes
  • Group commit / batching to amortize fsync cost
  • Recovery process: truncate at first invalid record
  • Use of fdatasync vs fsync
  • Sector-aligned writes to avoid torn sectors
  • Idempotent replay and checkpointing

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

Q3

Describe your compaction and garbage collection strategy for the on-disk data structures.

System Design
Author's notes

Talked about merging SSTables and dropping tombstones for deleted keys.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the context: what data structures (e.g., LSM trees, Delta Lake logs), workload characteristics, and performance goals. Then describe a layered strategy: background compaction to merge small files and reclaim space, garbage collection to remove obsolete versions, and tuning parameters to balance write amplification, read performance, and storage cost. Emphasize how you monitor and adapt the strategy based on metrics.

Pro tip: Tie your strategy to concrete trade-offs and metrics—e.g., 'We target <10% write amplification and keep file sizes at 128MB to optimize read throughput'—and mention how you'd handle failures and concurrency to show production maturity.

1. Clarify requirements and constraints

Ask about the data structures, workload patterns (read/write ratio, latency SLAs), and storage costs to tailor your answer.

2. Describe compaction strategy

Explain how you merge small files or SSTables, choose compaction triggers (size, count, age), and manage write amplification vs. read performance.

3. Describe garbage collection strategy

Detail how you identify and remove obsolete data (e.g., old versions, tombstones), using reference counting or time-based retention, and ensure safety with concurrent reads/writes.

4. Discuss tuning and trade-offs

Cover parameter tuning (e.g., compaction interval, file size targets) and trade-offs between I/O, CPU, storage, and latency.

5. Explain monitoring and adaptation

Mention metrics (e.g., file count, compaction lag, GC reclaim rate) and how you'd adjust the strategy based on observed performance.

Key Points to Mention

  • LSM-tree compaction (e.g., leveled, tiered) and its impact on read/write amplification
  • Delta Lake / Apache Spark specifics: OPTIMIZE, VACUUM, and time travel retention
  • File size tuning (e.g., 128MB target) to balance read throughput and metadata overhead
  • Handling concurrent reads/writes during compaction and GC (e.g., snapshot isolation, MVCC)
  • Metrics to monitor: compaction lag, number of small files, GC reclaim rate, query latency
  • Trade-offs: write amplification vs. read performance, storage cost vs. query speed

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

Q4

What concurrency model would you use: single-writer with multiple readers, or multiple writers? Would you use lock-based or optimistic concurrency, and how do you ensure correctness?

System DesignTechnical Trade-offs
Author's notes

I went with single-writer to keep things simple and avoid write-write conflicts, then talked about MVCC for readers so they don't block writers.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints of the system, then compare single-writer/multiple-readers vs multiple-writers and lock-based vs optimistic concurrency, explaining trade-offs. Finally, discuss how to ensure correctness through invariants, isolation levels, and testing.

Pro tip: Tie your answer to Databricks' domain (e.g., Delta Lake's optimistic concurrency control) to show domain awareness and practical experience.

1. Clarify Requirements

Ask about read/write ratios, latency requirements, consistency needs, and failure modes to ground your choice in the actual use case.

2. Compare Concurrency Models

Discuss single-writer/multiple-readers (simpler, avoids write conflicts) vs multiple-writers (higher write throughput but complex coordination), and when each is appropriate.

3. Choose Locking Strategy

Explain lock-based (pessimistic) vs optimistic concurrency, covering trade-offs like contention, deadlocks, retries, and scalability.

4. Ensure Correctness

Describe how to maintain invariants, use transactions/isolation levels, handle conflicts (e.g., retries, conflict resolution), and validate with testing and monitoring.

5. Conclude with Recommendation

Summarize your choice based on the requirements, and mention how you would evolve the design as the system scales.

Key Points to Mention

  • Trade-offs between single-writer and multiple-writers: simplicity vs throughput, contention, and coordination overhead.
  • Lock-based vs optimistic concurrency: blocking, deadlocks, scalability vs retries, conflict detection, and wasted work.
  • Isolation levels (e.g., serializable, snapshot isolation) and their role in correctness.
  • Techniques for ensuring correctness: invariants, atomic operations, conflict resolution, and idempotency.
  • Real-world examples: Delta Lake's optimistic concurrency, database MVCC, or distributed consensus protocols.
  • Testing and monitoring: stress tests, fault injection, and metrics to detect concurrency issues.

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

Q5

What consistency guarantees does your design provide, and how do read-after-write semantics work under concurrent access?

System DesignTechnical Trade-offs
Author's notes

I said read-after-write is guaranteed for the writing thread if reads go through the same in-memory buffer before flushing to disk.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explicitly stating the consistency model your design targets (e.g., strong, eventual, or read-your-writes) and justify the choice based on the use case. Then explain how read-after-write semantics are achieved under concurrent access, covering mechanisms like versioning, quorum reads/writes, or session tokens. Finally, discuss trade-offs and how you handle edge cases like network partitions or replica lag.

Pro tip: Databricks values deep understanding of distributed systems trade-offs; mention how you would measure and monitor consistency violations (e.g., via metrics or tracing) to ensure the design meets SLAs. Also, relate your answer to real-world systems like Delta Lake or Spark, showing familiarity with Databricks' ecosystem.

1. Define the consistency model

Clearly state the consistency guarantees your design provides (e.g., strong, eventual, causal) and explain why it's appropriate for the application's requirements.

2. Explain read-after-write semantics

Describe how the system ensures that a client that writes a value can subsequently read that value, even under concurrent access, using techniques like session tokens, version vectors, or quorum reads.

3. Address concurrency and conflicts

Discuss how concurrent writes and reads are handled, including conflict resolution strategies (e.g., last-write-wins, CRDTs) and how they affect consistency.

4. Discuss trade-offs and failure modes

Analyze the trade-offs between consistency, availability, and latency (CAP theorem), and explain how the design behaves under failures like network partitions or node crashes.

5. Validate with examples and metrics

Provide concrete examples of read-after-write scenarios and mention how you would test or monitor consistency guarantees in production.

Key Points to Mention

  • CAP theorem and the specific trade-offs made (e.g., CP vs AP).
  • Techniques for read-after-write: session tokens, sticky sessions, versioning, or quorum reads/writes.
  • Concurrency control mechanisms: optimistic/pessimistic locking, MVCC, or timestamps.
  • Real-world examples: how systems like Delta Lake, Apache Spark, or Amazon DynamoDB handle consistency.
  • Monitoring and metrics: how to detect consistency violations (e.g., replication lag, stale reads).
  • Edge cases: handling network partitions, replica failures, and clock skew.

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

Q6

Do some back-of-the-envelope estimates for the resource requirements of this system.

System DesignTechnical Trade-offs
Author's notes

Blanked for a second here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system's scope and key assumptions (e.g., user base, request rate, data volume). Then break down the system into components and estimate each component's resource needs using simple arithmetic, focusing on order-of-magnitude accuracy. Finally, validate your estimates against known benchmarks and discuss potential bottlenecks.

Pro tip: Always state your assumptions explicitly and round numbers aggressively to keep calculations simple; interviewers care more about your reasoning process than precise numbers. Also, relate your estimates to real-world systems (e.g., 'This is similar to Twitter's scale') to demonstrate practical insight.

1. Clarify scope and assumptions

Ask clarifying questions to understand the system's functionality, expected scale (users, requests per second, data size), and any constraints. State your assumptions clearly.

2. Identify key components and metrics

Break the system into major components (e.g., web servers, databases, caches) and determine the relevant resource metrics for each (CPU, memory, storage, network bandwidth).

3. Estimate per-component requirements

For each component, use simple calculations to estimate resource needs based on the assumptions. For example, calculate QPS, then derive number of servers needed based on per-server capacity.

4. Aggregate and validate

Sum up the estimates to get total resource requirements. Sanity-check against known benchmarks or similar systems, and adjust assumptions if needed.

5. Discuss trade-offs and bottlenecks

Highlight potential bottlenecks (e.g., database writes, network latency) and discuss how design choices (e.g., sharding, caching) affect resource usage.

Key Points to Mention

  • Assumptions: user base, daily active users, requests per second, data size per user/request
  • Back-of-the-envelope calculations: use powers of 10, round aggressively, focus on order of magnitude
  • Resource metrics: CPU cores, memory (RAM), storage (disk), network bandwidth (ingress/egress)
  • Scalability: horizontal vs vertical scaling, sharding, replication, caching strategies
  • Bottlenecks: single points of failure, hot spots, I/O limits
  • Validation: compare with real-world systems (e.g., 'Facebook handles X requests per second with Y servers')

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

Q7

What would a minimal testing plan look like for this system, specifically around failure injection and recovery?

System DesignTechnical Trade-offs
Author's notes

Talked about injecting crashes at various points in the WAL write path, corrupting individual log records to test checksum detection, and verifying that recovery replays correctly.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system's critical components and failure modes, then outline a minimal test plan that prioritizes high-impact failure scenarios. Focus on a few key tests that validate recovery mechanisms, such as fault injection at service boundaries and verifying data consistency after recovery.

Pro tip: Emphasize that a minimal plan should be iterative and automated, starting with the most probable failures and expanding based on learnings. Mention that testing recovery is as important as testing failure, and include metrics to measure recovery time and data loss.

1. Identify Critical Components and Failure Modes

Determine which parts of the system are most critical (e.g., data storage, computation engine) and enumerate potential failures (e.g., node crashes, network partitions). Prioritize based on impact and likelihood.

2. Define Minimal Failure Injection Tests

Select a small set of failure injection tests that cover the most critical failure modes, such as killing a worker node, introducing network latency, or simulating disk failures. Use existing tools like Chaos Monkey or custom scripts.

3. Specify Recovery Validation Criteria

For each test, define clear success criteria for recovery, such as system availability within X seconds, no data loss, and consistency checks. Include both functional and non-functional requirements.

4. Automate and Integrate into CI/CD

Automate the failure injection and recovery validation to run regularly in a staging environment. Integrate with CI/CD pipelines to catch regressions early.

5. Iterate Based on Results

Start with a minimal set, analyze results, and gradually expand coverage. Use metrics to identify gaps and improve the plan over time.

Key Points to Mention

  • Fault injection techniques: node failure, network partition, disk I/O errors, and latency injection.
  • Recovery mechanisms: automatic failover, retry logic, checkpointing, and data replication.
  • Observability: monitoring, logging, and tracing to detect failures and measure recovery.
  • Data consistency: ensuring no data loss or corruption after recovery, using checksums or validation queries.
  • Automation: using tools like Chaos Monkey, Gremlin, or custom frameworks to inject failures.
  • Metrics: recovery time objective (RTO), recovery point objective (RPO), and mean time to recovery (MTTR).

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