Design a Distributed Key-Value Store

Harder 6
ConsistencySharding TikTok

Design a distributed key-value store that other teams use as their database. Clients put and get values by key; the store spreads data across many machines and keeps working when some of them fail.

Functional:

  • put(key, value), get(key), and delete(key), with values up to 1 MB.
  • Let each client choose consistency per request: fast and possibly stale, or strongly consistent.
  • Add and remove machines without downtime.

Non-functional:

  • Single digit millisecond latency at p99 for gets and puts within a region.
  • Survive the loss of any one machine, and of a whole availability zone, without losing acknowledged writes.
  • Keep working for writes during a network partition, with a clear rule for resolving conflicts.
  • 100 TB of data, 1 KB average value.
  • 2 million reads and 500,000 writes per second at peak.
  • 300 storage nodes in 3 availability zones.

Secondary indexes, transactions across keys, and cross-region replication.

System design
Loading editor...