"Design a distributed key-value store that supports 10 million reads per second and 1 million writes per second for TikTok's user session data."
ByteDance operates one of the largest distributed storage infrastructures in the world. Backend engineers must understand how to design systems that handle extreme throughput with strong consistency guarantees. This question tests your knowledge of distributed systems fundamentals that you will use daily at ByteDance.
Define the requirements: read-heavy workload (10:1 ratio), low latency (p99 < 10ms), high availability (99.99%), data size per key (~1KB session data).
Describe the architecture: consistent hashing for partitioning, leader-based replication per partition, memory-first storage with WAL for durability.
Explain the read path: serve from in-memory cache on any replica for eventual consistency, or route to leader for strong consistency.
Explain the write path: client writes to partition leader, leader appends to WAL, replicates to followers, and acknowledges after majority write.
I would design a partitioned, replicated in-memory KV store. Data is split across 4,096 partitions using consistent hashing with virtual nodes to ensure even distribution. Each partition has a leader and two followers using Raft consensus for strong consistency. For the read path at 10M RPS, reads are served from any replica's in-memory hash table — since session data tolerates slightly stale reads, this distributes load across all replicas. For strong-consistency reads, clients route to the leader and verify the read index against the committed Raft log. For the write path at 1M WPS, the client hashes the key to find the partition leader, which appends the write to a WAL, batches operations every 1ms, and replicates to followers. After majority acknowledgment, the leader responds and applies the write to its in-memory store. For durability, the WAL is synced to SSD every 100ms. To handle hot keys (e.g., viral user sessions), I would implement key-level caching in a separate hot-key layer that absorbs bursts. Cluster management uses an etcd-backed controller that detects node failures via heartbeats and triggers leader re-election within 2 seconds.
Clearly separate the read and write paths — interviewers want to see you think about each independently.
Discuss the consistency trade-off: eventual consistency for most reads enables massive throughput, with strong consistency available when needed.
Mention hot-key handling — at TikTok scale, a single viral user can generate disproportionate load on one partition.
Consistent hashing distributes keys more evenly for random-access workloads like session lookups. Range-based partitioning is better for scan-heavy workloads but creates hotspots when certain key ranges are more popular.
With Raft replication across three nodes, the system tolerates one node failure. The WAL ensures no acknowledged write is lost. When a node fails, the Raft group elects a new leader from the remaining followers, and a replacement node is provisioned and catches up from the leader's log.
HireMe AI listens to your interview in real-time, detects questions, and generates instant answer suggestions — so you never freeze up again.
Try HireMe AI Free