Project 18: Distributed Key-Value Store with RPC
A multi-server key-value store using RPC for client-server and server-server communication.
Quick Reference
| Attribute | Value |
|---|---|
| Primary Language | C |
| Alternative Languages | N/A |
| Difficulty | Level 4 (Expert) |
| Time Estimate | See main guide |
| Knowledge Area | Distributed Systems, Storage |
| Tooling | See main guide |
| Prerequisites | See main guide |
What You Will Build
A multi-server key-value store using RPC for client-server and server-server communication.
Why It Matters
This project builds core skills that appear repeatedly in real-world systems and tooling.
Core Challenges
- Identify the tricky edge cases and design for them.
Key Concepts
- Map the project to core concepts before you code.
Real-World Outcome
# Start 3 server replicas
$ ./kv_server --id=1 --port=9001 --peers=localhost:9002,localhost:9003 &
$ ./kv_server --id=2 --port=9002 --peers=localhost:9001,localhost:9003 &
$ ./kv_server --id=3 --port=9003 --peers=localhost:9001,localhost:9002 &
# Client connects to any server
$ ./kv_client --server=localhost:9001 put mykey "Hello World"
OK (replicated to 3 nodes)
$ ./kv_client --server=localhost:9002 get mykey
Hello World
# Kill a server, data still available
$ kill %1
$ ./kv_client --server=localhost:9002 get mykey
Hello World
Implementation Guide
- Reproduce the simplest happy-path scenario.
- Build the smallest working version of the core feature.
- Add input validation and error handling.
- Add instrumentation/logging to confirm behavior.
- Refactor into clean modules with tests.
Milestones
- Milestone 1: Minimal working program that runs end-to-end.
- Milestone 2: Correct outputs for typical inputs.
- Milestone 3: Robust handling of edge cases.
- Milestone 4: Clean structure and documented usage.
Validation Checklist
- Output matches the real-world outcome example
- Handles invalid inputs safely
- Provides clear errors and exit codes
- Repeatable results across runs
References
- Main guide:
UNIX_IPC_STEVENS_VOL2_MASTERY.md - Primary references are listed in the main guide