Design a key-value store

Quick Overview

This question evaluates knowledge of distributed storage and system design concepts, including data modeling, partitioning and consistent hashing, replication and consensus, write/read path trade-offs (e.g., LSM-tree vs B-Tree), compaction, caching, failure handling, and support for efficient range scans in a scalable key–value store.

Design a key-value store

Company: Google

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Technical Screen

Design a scalable key-value store supporting get, put, delete, and range scan. Discuss data model, partitioning and consistent hashing, replication, the write path (LSM versus B-Tree), compaction, read caching, consistency levels, and failure handling.

Quick Answer: This question evaluates knowledge of distributed storage and system design concepts, including data modeling, partitioning and consistent hashing, replication and consensus, write/read path trade-offs (e.g., LSM-tree vs B-Tree), compaction, caching, failure handling, and support for efficient range scans in a scalable key–value store.

|Home/System Design/Google
Google logo
Google
Sep 6, 2025, 12:00 AM
hardSoftware EngineerTechnical ScreenSystem Design
23
0

System Design: Scalable Key–Value Store with Range Scans

You are asked to design a distributed key–value (KV) store that supports the following operations at scale:

  • get(key)
  • put(key, value)
  • delete(key)
  • range_scan(start_key, end_key, limit)

Assume billions of keys, multi-terabyte datasets, horizontal scalability, and high availability across multiple availability zones. Low p99 latency is desired for point lookups and sequential range scans.

Discuss and justify design choices for the following topics:

  1. Data model and API semantics (keys, values, ordering, TTLs, versioning, deletes/tombstones, range scans)
  2. Partitioning scheme and consistent hashing (how to scale out, balance load, and support efficient range scans; splitting/merging; hot-spot mitigation)
  3. Replication (topology, placement, quorum vs consensus, replica count, cross-AZ)
  4. Write path: LSM-tree versus B-Tree (trade-offs and your choice)
  5. Compaction strategy (policies, amplification, tombstones, TTL expiry, backpressure)
  6. Read path and caching (Bloom filters, block/row cache, readahead/prefetch for scans)
  7. Consistency levels (point reads/writes and range scans; options and guarantees)
  8. Failure handling (node/zone/network failures, recovery, rebalancing, data integrity)

Provide a high-level architecture and call out key trade-offs, pitfalls, and how you will validate the design under load.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...