Design a Key-Value Store

hard
partitioning
replication
consistency
storage

Problem brief

A key-value store does one thing: store a value under a key and give it back later. On one machine that's a hash map plus a file. The interview question is about doing it across dozens of machines: splitting the keys so each machine holds a fair share, keeping copies so no single failure loses data, letting the caller choose between speed and consistency, and continuing to accept reads and writes while a node is dead. Every database you use is a key-value store underneath, so this design also explains how Cassandra, DynamoDB and Riak work.

Practice workspace

Guided practice or a locally saved 45-minute mock.

Step 1 of 13

Functional Requirements

What operations does the store support, and what would you explicitly leave out of version one?

Reference solution hidden

Try answering in the workspace above first. Reveal the full worked solution — data model, architecture, and trade-offs — whenever you want to compare.

Open the full solution page →