Skip to main content
PreparationZone Logo
PrepZone

Key-Value Store

Design a distributed KV store with partitioning, replication and tunable consistency.

Pass checkpoint below

Read these first

Design a KV store like Dynamo: PUT key → value, GET key → value, at billions of keys and millions of ops/sec with node failures handled gracefully.

Requirements

Functional requirements

  • put(key, value) — store or overwrite a value.
  • get(key) — retrieve value or not-found.
  • delete(key) — remove a key.
  • Support values from bytes to megabytes.

Non-functional requirements

  • Availability: 99.99% — tolerate node and rack failures.
  • Latency: p99 GET under 10 ms; p99 PUT under 20 ms.
  • Scale: Billions of keys; horizontal scale by adding nodes.
  • Durability: Survive node crash without data loss (replication factor 3).
  • Consistency: Tunable — strong for critical keys, eventual for cache-like keys.

Estimation

  • 1B keys × 1 KB average = 1 TB raw data × replication factor 3 = 3 TB cluster.
  • 1M ops/sec peak → ~1M GET/s + 100K PUT/s — each node handles ~50K ops with 20 nodes.
Hash ring0 … 2^32-1
Node Akeys 0–25%
Node Bkeys 25–50%
Node Ckeys 50–75%
Node Dkeys 75–100%

New node E joins → only ~1/N keys move, not all keys.

Adding a node only remaps keys adjacent to it on the ring.

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 4 sections

  • Data partitioning
  • Replication and consistency
  • Architecture
  • Handling failures

Test yourself

Answer these before moving on — recall is what makes it stick.