DB Sharding Sim
Settings
DB Architect Pro
Distributed Systems Simulation Suite v2.4Architecture Concepts
Modulo Hashing
The most basic form of sharding using hash(key) % N. While simple to implement, it suffers from the "Rebalancing Storm."
The Flaw: Changing N (adding/removing a server) changes the result of the modulo for almost every key. This forces the database to move nearly 100% of data to new locations, causing massive downtime.
Consistent Hashing
Treats the hash space as a ring (0-360°). Nodes are placed on the ring. Keys are mapped to the ring and assigned to the next clockwise node.
The Solution: When a node is added, it only takes keys from its immediate neighbor. Only K/N keys need to move. This minimizes data transfer during scaling events.
Virtual Nodes (vNodes)
In standard Consistent Hashing, a node might get a "large slice" of the ring purely by luck, causing hotspots.
How it works: Each physical server is assigned multiple positions (vNodes) on the ring (e.g., Node A appears at 10°, 150°, and 290°). This statistically smooths out the distribution, ensuring a uniform load (Low Standard Deviation).