Uniform Across All Shards
The strategy of splitting the entities into a number of shards uniformly.
Uses a hash code of the entity identifier and the remainder of its division by the total number of shards to determine the index of a shard, at which the modification is allowed. To reach the consistency of the hash code values across JVMs, the MurmurHash3, x86 variant is used.
While Guava's Hashing
is marked @Beta
, it is still the best option for hashing functions — not to involve any heavy-weight third-party hashing solutions.
Functions
Link copied to clipboard
Creates a strategy of uniform target distribution across shards, for a given shard number.
Link copied to clipboard
Tells how many shards there are according to this strategy.
Link copied to clipboard
Returns a pre-defined strategy instance, which defines a single shard and puts all the targets into it.