Heterogeneous Node Weights
What You'll Learn
You'll learn how to assign more virtual nodes to more powerful servers in a consistent hash ring, ensuring each machine handles load proportional to its actual capacity.
The Core Problem
In real-world distributed systems, not all servers are created equal. You might have a mix of older hardware, newer machines with double the RAM, or cloud instances of different sizes. If you treat every physical node equally in your consistent hash ring, a small server gets the same workload as a beast with 10x the resources—leading to bottlenecks and wasted capacity.
The Weight-Based Solution
Heterogeneous node weights solve this by varying the number of virtual nodes assigned to each physical server based on its capacity. A high-capacity server gets more virtual nodes than a low-capacity one.
How It Works
Instead of giving every server the same number of virtual nodes (say, 150), you assign them proportionally:
- Small server (2 cores, 4GB RAM): 50 virtual nodes
- Medium server (4 cores, 8GB RAM): 100 virtual nodes
- Large server (8 cores, 16GB RAM): 200 virtual nodes
Now when keys land on the ring, the large server claims roughly 4x more data than the small one—matching its 4x greater capacity.
Practical Analogy
Think of a restaurant with three delivery drivers: one on a bicycle, one in a car, and one in a van. Assigning them equal delivery zones would overwhelm the cyclist. Instead, you give the van driver 4x the zone size, matching their carrying capacity.
Implementation Considerations
When a server joins with weight W, create W × base_virtual_nodes virtual nodes for it. The ring automatically distributes load proportionally without manual rebalancing.
Key Takeaway: Heterogeneous node weights let you match virtual node distribution to actual hardware capacity, preventing bottlenecks and maximizing resource utilization across mixed infrastructure.