Consistent hash function

from Wikipedia, the free encyclopedia
Above: output distribution, then removal of the third container. Rearrangement in the case of inconsistent (middle) or rearrangement in the case of consistent hashing (bottom)

A consistent hash function is a hash function that minimizes the number of reallocations. Reassignments are always made when containers are added or removed.

The upper part of the picture shows a distribution of keys to containers. If a container is now removed, as happened in the middle area of ​​the screen, all keys are redistributed to the containers that are now available when an inconsistent hash function is used. However, if a consistent hash function is used, as shown in the lower section, only the keys of the removed container are distributed to the surrounding containers. All other containers remain unaffected.

Consistent hash functions have the following properties:

  • One-way predictability
  • Collision resistance
  • Equality
  • efficient predictability

Consistent hash functions are the basis of distributed hash tables .