3 ms·
This article describes modulo as a possible strategy for sharding/partitioning a DBMS. While modulo (along with random allocation) has an instructional value a
by almog 5y ago
This article describes modulo as a possible strategy for sharding/partitioning a DBMS.
While modulo (along with random allocation) has an instructional value as an introduction to partitioning, it's best followed by a warning when it comes rebalancing: it violates a basic requirement for most partitioning schemes (with the exception of distributed partitioned logs), that is, rebalancing better move as few items as possible.
- zeckalpha 5y agoIt depends on how you do it. If you assign values to a ring and have nodes cover adjacent items on the ring (node A is primary for n, secondary for n+1 and n-1), then the rebalancing is much more efficient and can happen in the background.
- almog 5y agoWhat you're describing is Consistent Hashing. It is a mean to _assign partitions to nodes_ and it is independent of how you partition your _data_ (though it's typically used with hash based partitioning of th edata). At any rate, the way I understood it, the article described partitioning of the data by `key mod k`, k being the current number of nodes.