Skip to main content
QUICK REVIEW

[Paper Review] Perfect Consistent Hashing

M Sackman|arXiv (Cornell University)|Mar 17, 2015
Algorithms and Data CompressionComputer Science6 references5 citations
TL;DR

This paper presents a deterministic perfect consistent hashing algorithm that achieves exact uniformity and minimal remapping when adding or removing hash codes, using universal cycles of permutations instead of random placement on a circle. Unlike the classic algorithm, which relies on probabilistic assumptions and approximates uniformity, this method ensures precise distribution through combinatorial permutation generation, with a trade-off of higher computational cost but perfect correctness and determinism.

ABSTRACT

Consistent Hashing functions are widely used for load balancing across a variety of applications. However, the original presentation and typical implementations of Consistent Hashing rely on randomised allocation of hash codes to keys which results in a flawed and approximately-uniform allocation of keys to hash codes. We analyse the desired properties and present an algorithm that perfectly achieves them without resorting to any random distributions. The algorithm is simple and adds to our understanding of what is necessary to create a consistent hash function.

Motivation & Objective

  • To address the inherent flaws in classic consistent hashing, which relies on randomised hash code placement and only approximates uniformity.
  • To develop a deterministic algorithm that achieves perfect uniformity in hash distribution when adding or removing hash codes.
  • To ensure minimal remapping—only keys assigned to the newly added or removed hash code are relocated—without altering existing mappings.
  • To eliminate reliance on random distributions while maintaining the core properties of consistent hashing: determinism, uniformity, and minimal remapping.
  • To provide a mathematically rigorous alternative to the classic algorithm with provable correctness and improved theoretical understanding.

Proposed method

  • The algorithm replaces the circular hash space of the classic method with a permutation-based construction using universal cycles of shorthand permutations.
  • It generates a full permutation of hash codes for each key by recursively partitioning the key’s entropy using modular arithmetic and predefined hash code sequences.
  • The method ensures that when a new hash code is added, each existing hash code yields exactly 1/|C′| of its keys to the new code, preserving uniformity.
  • The algorithm dynamically constructs the permutation as the key is consumed, avoiding full tree storage and reducing memory overhead.
  • It uses a deterministic mapping from key values to permutations via a factorial number system, ensuring every possible permutation is reachable if key entropy is sufficient.
  • The algorithm supports both insertion and deletion of hash codes with exact redistribution, maintaining uniformity without remapping existing keys between old codes.

Experimental results

Research questions

  • RQ1Can consistent hashing be achieved with perfect uniformity without relying on random distributions?
  • RQ2How can the remapping property be preserved exactly during hash code addition and deletion?
  • RQ3What combinatorial structure enables deterministic, uniform redistribution of keys when the set of hash codes changes?
  • RQ4Is it possible to construct a consistent hash function that avoids the statistical approximation of the classic algorithm?
  • RQ5What is the computational cost of achieving perfect consistency, and can it be mitigated through incremental construction?

Key findings

  • The proposed algorithm achieves perfect uniformity: for any key, the probability of mapping to any hash code is exactly 1/|C| after any addition or removal.
  • The algorithm ensures minimal remapping: only keys previously assigned to the newly added or removed hash code are relocated, with no changes to other mappings.
  • The average time complexity is O(|C| log |C|) for generating a full permutation, or O(|C|) for a single result, which is higher than the classic algorithm’s O(log |C|).
  • The method avoids storing all hash code positions in memory by dynamically generating the permutation as the key is consumed, reducing memory usage.
  • The algorithm is sensitive to key entropy: if the key space has insufficient entropy, not all permutations are reachable, and some hash codes may never appear at the front of the permutation.
  • The approach enables practical use in distributed systems by providing a deterministic, predictable ordering of nodes for read/write operations, improving load balancing and latency in hot key scenarios.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.