Ensuring Scalability and Replication

Learn how consistent hashing enables scalability, and how we replicate such partitioned data.

Adding scalability

Let’s start with one of the core design requirements, i.e., scalability. We are storing key-value data in storage nodes. With the change in demand, we might need to add or remove storage nodes. It means we need to partition data over the nodes in the system to distribute the load across all nodes.

For example, let’s consider that we have four nodes, and we want 25% of the requests to go to each node to balance the load equally. The traditional way of solving this is through the modulus operator. When a request comes in, assign a request ID, calculate its hash, and find the remainder by taking the modulus with the number of nodes available. The remainder value is the node number, and we send the request to that node to process it.

The following slides explain this process.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy