Adding replication to the Key-Value Store
During the past few weeks I’ve built a basic key-value store that persists data to disk. It works, but only as a single node, so there is a fixed limit on the amount of data it can store, and the througput it can sustain.
We can make the store scale horizontally in two ways:
- Replication, which keeps additional copies of the data in other nodes, improving throughput.
- Sharding, which partitions the keys across different nodes, so that we can store more data.
In this post I’m going to tackle the first one, replication, refactoring the storage layer so that we can have as many replicas as we want serving reads. All the code is available in GitHub.
Read more →