How geohot/minikeyvalue works
Project type and purpose
• This is “minikeyvalue,” a lightweight distributed key–value store implemented in Go (~1 000 lines).
• It exposes an HTTP API (including a subset of S3), uses LevelDB for metadata, and leverages stock nginx as the volume (blob) server.
• Primary use cases: scalable storage of 1 MB–1 GB values, replication across machines and disks, rebalance and rebuild operations, production‐ready at comma.ai.
File structure
• Top-level:
• src/ — Go source for the mkv binary (main.go, server.go, s3api.go, rebalance.go, rebuild.go, lib.go)
• volume — compiled volume server (nginx wrapper)
• Dockerfile, go.mod/go.sum, requirements.txt — build/deployment configs
• tools/ — bringup/kill scripts, benchmarks (thrasher.go), tests (s3test.py, test.py), helper utilities
• CI config in .github/workflows/test.yml
• mkv CLI supports subcommands: server, rebalance, rebuild
README for architectural insights
• Master server (port 3000) handles metadata and coordinates volumes
• Volume servers (ports 3001–3003) are plain nginx processes serving blobs from local disk directories
• Index persisted in LevelDB; rebuild regenerates it from volumes; rebalance redistributes data when volumes change
• Clients interact over HTTP: GET returns 302 redirect to a volume, PUT/DELETE are proxied/blocking operations