RETURN TO SYSTEM DESIGN VAULT (55)BLUEPRINT #12 // Medium
#12MediumCore Distributed Systems
Design a Key-Value Store
ASKED IN INTERVIEWS AT:AppleGoogleCanvaAvalara
EXECUTIVE SUMMARY & PROBLEM STATEMENT
Design a distributed key-value store (like DynamoDB or Cassandra) featuring tunable consistency (quorum), consistent hashing with virtual nodes, and SSTables/LSM trees.
SCALE ESTIMATION & TRAFFIC ENVELOPE
DAILY ACTIVE USERS / TPS10 Million RPS peak
READ / WRITE TRAFFIC RATIOTunable (50/50 read-write)
5-YEAR STORAGE CAPACITYDistributed shards holding petabytes of data across nodes
FUNCTIONAL REQUIREMENTS
- [1]Put(key, value) and Get(key) operations
- [2]Support values up to 10MB
- [3]Configurable read/write consistency levels
NON-FUNCTIONAL REQUIREMENTS
- •Sub-5ms single-key latency
- •Linear horizontal scalability
- •No single point of failure (decentralized ring)
CORE ARCHITECTURAL COMPONENTS
Consistent Hashing Virtual Node Ring
Storage Engine (RocksDB/LSM)
Bloom Filters (prevent disk reads)
Gossip Protocol
Anti-Entropy Merkle Trees
DATA SCHEMA & PERSISTENCE
MemTable (Red-Black Tree in RAM) -> Write-Ahead Log (WAL) -> SSTables on Disk
DISTRIBUTED TRADE-OFFS & FAILURE MODES
- ⟡LSM Trees optimize write throughput via sequential disk writes, requiring background compaction; B-Trees optimize read latency.