Professional Documents
Culture Documents
The key space is split into 16384 slots, effectively setting an upper limit for the cluster
size of 16384 master nodes (however the suggested max size of nodes is in the order
of ~ 1000 nodes).
Each master node in a cluster handles a subset of the 16384 hash slots. The cluster
is stable when there is no cluster reconfiguration in progress (i.e. where hash slots are
being moved from one node to another). When the cluster is stable, a single hash slot
will be served by a single node (however the serving node can have one or more slaves
that will replace it in the case of net splits or failures, and that can be used in order to
scale read operations where reading stale data is acceptable).
The base algorithm used to map keys to hash slots is the following (read the next
paragraph for the hash tag exception to this rule):
14 out of 16 CRC16 output bits are used (this is why there is a modulo 16384 operation
in the formula above).
In our tests CRC16 behaved remarkably well in distributing different kinds of keys
evenly across the 16384 slots.
Note: A reference implementation of the CRC16 algorithm used is available in the
Appendix A of this document.