← Databricks Interview Insights

Databricks·Software Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Phone screen at Databricks, one question, system design flavor but kept pretty contained. Not a brutal round but the QPS tracking piece has some gotchas if you haven't thought about sliding windows before.

Questions Asked (1)

Q1

Design a key-value store that supports put, delete, and a method to query the average queries per second over the last five minutes.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

The put and delete parts are easy enough that you might spend too long on them and then scramble when they ask about the QPS tracking.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (scale, consistency, latency, data size) and then design the core key-value store with a simple in-memory hash map and persistence options. For the average QPS over the last five minutes, propose a sliding window approach using a ring buffer of per-second counters, and discuss trade-offs between accuracy and memory. Finally, address concurrency, scalability, and potential optimizations like sharding or using a time-series database.

Pro tip: Demonstrate awareness of real-world constraints by discussing how to handle high cardinality and memory overhead of per-second counters, and suggest approximate methods like exponential moving averages if exact precision isn't critical.

1. Clarify Requirements

Ask about expected scale (QPS, data size), consistency needs, latency requirements, and whether the QPS metric needs to be exact or approximate. This shows you think before coding.

2. Design Core Key-Value Store

Propose a basic in-memory hash map for fast put/delete, and discuss persistence options (e.g., write-ahead log, LSM trees) if durability is needed. Mention concurrency control (e.g., sharding, locks).

3. Implement QPS Tracking

Use a sliding window of per-second counters (e.g., a ring buffer of 300 counters) to track queries. On each query, increment the current second's counter. To get average QPS, sum the counters and divide by 300.

4. Address Scalability and Trade-offs

Discuss how to scale the QPS tracking across multiple nodes (e.g., aggregate per-node counters) and trade-offs between memory usage and accuracy (e.g., using buckets of 10 seconds instead of 1 second).

5. Optimize and Handle Edge Cases

Consider optimizations like using atomic counters for thread safety, handling clock skew, and resetting counters. Mention alternative approaches like using a time-series database or approximate algorithms (e.g., EMA).

Key Points to Mention

  • Use a ring buffer of per-second counters for the sliding window to efficiently compute average QPS over the last 5 minutes.
  • Discuss concurrency control: atomic operations or locks to ensure thread-safe updates to counters and the key-value store.
  • Trade-offs between memory and accuracy: smaller time buckets give more accuracy but use more memory; larger buckets reduce memory but smooth out spikes.
  • Scalability: sharding the key-value store and aggregating QPS metrics across nodes, possibly using a distributed counter or a centralized monitoring system.
  • Persistence and durability: if the store must survive restarts, consider write-ahead logging or periodic snapshots.
  • Alternative approaches: using a time-series database (e.g., Prometheus) for QPS tracking, or approximate algorithms like exponential moving averages for lower memory footprint.

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