Design a Key-Value Store
Design a distributed key-value store that other teams use as a building block: put(key, value), get(key) and delete(key), nothing more. Think of the store behind shopping carts, user sessions, feature settings or device state. Values are opaque bytes; the store does not look inside them.
It holds 10 billion keys, about 10 TB of live data, and serves 300,000 operations a second on average and 1 million at peak, 80% of them reads. It must keep answering when a machine, a disk or a whole zone fails, never lose a write it has acknowledged, and answer in a few milliseconds. The hard part is that these goals pull against each other: copies on several machines give durability and availability, but then the copies can disagree, and you have to decide who waits for whom and how they converge.
Good questions to ask first
Decide what you would assume for each before you look at ours.
- 1How big are keys and values?
- 2What is the read and write mix?
- 3Strong or eventual consistency?
- 4Must writes succeed during failures?
- 5Do we need range scans or secondary indexes?
- 6Do keys expire?
- 7One region or many?
- 8Who are the clients?
How to spend the 45 minutes
- 5minPart 1: Requirements and scope
- 5minPart 2: Estimates
- 5minPart 3: API
- 15minPart 4: Architecture, stage by stage
- 15minPart 5: Deep dives and trade-offs