Subtracks & Tasks
Linearizable Key-Value Store
Implement Key-Value Interface
Implement the key-value store interface on top of Raft: 1. GET(key) - Return current value or null 2. PUT(key, value) - Set key to value 3. CAS(key, ...
Handle Client Request Routing
Route client requests to the leader: 1. Client sends request to any node 2. If node is leader, process request 3. If not leader, return redirect with...
Ensure Read Consistency
Implement linearizable reads: Option 1: Log reads (simple but slow) - Treat reads as log entries, wait for commit Option 2: ReadIndex (Raft optimiza...
Handle Client Retry and Deduplication
Handle client retries without duplicate execution: 1. Client assigns sequence number to each request 2. Server tracks (client_id -> latest_seq, respo...
Implement Log Compaction with Snapshots
Implement log compaction with snapshots: 1. Periodically snapshot state machine state 2. Record snapshot index and term 3. Discard log entries before...
Read Optimization
Implement Read Index for Linearizable Reads
Implement the "read index" optimization: the leader records the current commit index, confirms it still leads via heartbeats, then serves the read. Li...
Implement Lease-Based Reads
Implement lease-based reads: the leader uses its active lease to serve reads without network round trips. Document the clock assumption required. ```...
Add Follower Reads with Bounded Staleness
Implement follower reads with bounded staleness. Clients can opt to read from any follower if they accept data up to T seconds stale. This scales read...
Guarantee Read-Your-Writes with Follower Reads
Ensure read-your-writes consistency even when using follower reads. Clients send their `last_write_index` with each read. Followers only serve if they...
Benchmark Read Strategies Under Mixed Workload
Benchmark three read strategies under an 80% read / 20% write workload. Measure throughput and latency for each. ```json Request: {"type": "read_ben...
Transactions on Raft
Implement Multi-Key Transactions as Atomic Log Entries
Implement multi-key transactions. A transaction is a batch of operations committed as a single log entry for atomicity. ```json Request: {"type": "t...
Implement Optimistic Concurrency Control
Implement optimistic concurrency control (OCC). Read keys with version tracking, then commit only if no versions changed since the read. ```json Requ...
Implement Multi-Version Concurrency Control
Implement MVCC: keep multiple versions of each key. Readers get a consistent snapshot without blocking writers. ```json Request: {"type": "mvcc_put"...
Build a Mini TiKV with Raft + MVCC Regions
Build a mini version of TiKV: partition the key space into regions, each with its own Raft group and MVCC storage. ```json Request: {"type": "region...
Benchmark Contended Key Under OCC vs MVCC
Benchmark a contended-key scenario: 100 clients all updating the same key simultaneously. Compare OCC vs MVCC in terms of abort rate and throughput. ...
Interview Prep
Common interview questions for Distributed Systems / Backend Engineer roles that map directly to what you build in this track. Click any question to reveal the model answer.
Questions are representative of real interview patterns. Model answers are starting points — adapt them with your own experience and the specific context of the interview.
Common Mistakes
The top 5 mistakes builders make in this track — and exactly how to fix them. Click any mistake to see the root cause and the correct approach.
Comparison Mode
Side-by-side comparisons of the approaches, algorithms, and trade-offs you encounter in this track. Expand any comparison to see a detailed breakdown.
Concepts Covered
Prerequisites
It is recommended to complete the previous tracks before starting this one. Concepts build progressively throughout the curriculum.
Rabbit Holes
For when you want to go deeper. Curated papers, posts, and talks beyond what this track covers.
Bigtable: A Distributed Storage System for Structured Data
Chang et al., 2006. The paper that introduced the sorted string table (SSTable) model. The storage engine design in LevelDB, RocksDB, and Cassandra all descend from this.
The Log-Structured Merge-Tree (LSM-Tree)
O'Neil et al., 1996. The original LSM paper. Reading it after implementing B-Tree and LSM comparisons makes the write amplification tradeoff visceral rather than abstract.
LevelDB Implementation Notes
The implementation notes Jeff Dean and Sanjay Ghemawat wrote for LevelDB. Concrete, concise, and directly applicable to the storage engine you just built.
WiscKey: Separating Keys from Values in SSD-Conscious Storage
The paper behind the value log in BadgerDB. Separating keys from values reduces write amplification on SSDs dramatically. This is the insight that Wisckey turned into a production engine.