Distributed Key-Value Store
Consistent Hashing Ring with Write-Ahead Logging (WAL)
Highlights
- <5% key redistribution during node join and departure events
- Write-Ahead Logging (WAL) ensuring persistent ACID recovery
- Transparent cluster RPC forwarding supporting up to 16 nodes
System Overview
A distributed key-value store in Go implementing consistent hashing (Murmur3) to route keys across a multi-node cluster, Write-Ahead Logging for durability, and transparent RPC forwarding.
The Problem & Architectural Rationale
Simple modulo hashing ($hash(key) \pmod N$) causes nearly 100% of keys to remap whenever a node is added or removed, creating huge cache misses and data movement spikes in distributed databases.
Architecture & Components
1. Murmur3 Consistent Hash Ring
Maps keys and nodes to a 32-bit hash ring, routing operations to the next clockwise node and minimizing key movement to <5% on cluster topology changes.
2. Write-Ahead Logging (WAL)
Appends all mutations (put/delete) to a local fsync-backed binary log before in-memory application, enabling complete state replay on restart.
3. Transparent RPC Forwarding
Any node accepts client operations and transparently proxies calls to the partition owner using net/rpc with a 2-second dial timeout.
Outcomes & Results
- Achieved sub-2ms write acknowledgements with crash-safe log replay.
- Demonstrated predictable partition rebalancing across multi-node topologies.