Balanced allocations and double hashing

Michael Mitzenmacher

TL;DR

This paper investigates whether using "double hashing" (a more constrained way to generate random choices) significantly impacts the performance of balanced allocation algorithms, a fundamental problem in computer science. The authors demonstrate, both empirically and theoretically, that double hashing performs essentially identically to fully random choices in standard balanced allocation scenarios, meaning it offers the same performance benefits with less randomness.

What Problem Does This Paper Address?

The "balanced allocation" or "balls and bins" problem is a classic model for understanding how to distribute items (balls) into containers (bins) to minimize the maximum load on any single bin. A key result shows that if each ball can choose from d independent random bins, the maximum load is surprisingly low, around O(log log n). This relies on the strong assumption of truly independent random choices. However, in practice, generating perfectly independent random numbers can be computationally expensive. Double hashing is a technique that generates multiple hash values from just two initial hash functions, offering a more efficient way to achieve multiple choices. The central question this paper addresses is: does using double hashing, which inherently has dependencies between its generated choices, degrade the performance of balanced allocation compared to truly random choices?

Methods

The paper employs a multi-pronged approach:

  • Empirical Study: Extensive simulations were conducted to compare the load distributions and maximum loads of double hashing against fully random choices in various balanced allocation settings (standard d-choice, Vöcking's d-left, and queueing systems).
  • Theoretical Analysis (Witness Trees): The authors adapt the "witness tree" argument, a standard technique for analyzing balanced allocations, to the double hashing scenario. This method helps establish bounds on the maximum load, showing it remains O(log log n / log d). A key innovation here is how they handle the dependencies introduced by double hashing, requiring modifications to the standard witness tree activation criteria.
  • Theoretical Analysis (Fluid Limit): This is the paper's core theoretical contribution. They demonstrate that the fluid limit equations, which describe the asymptotic distribution of bin loads under fully random choices, also apply to double hashing. This is achieved by showing that the "ancestry lists" (representing the history of bin choices) for double hashing are "small" with high probability, leading to asymptotic independence of bin loads. This technique is inspired by prior work on queueing systems.

Datasets

Not discussed in the paper. The experiments are based on simulations with parameters like the number of balls (n), bins (n), and choices (d).

Key Insights and Ideas

  • Double Hashing is "Good Enough": The most striking insight is that double hashing, despite its inherent dependencies, provides performance indistinguishable from truly random choices in the context of balanced allocation. This is a significant finding for practical system design.
  • Fluid Limits Bridge the Gap: The paper elegantly shows that the sophisticated fluid limit framework, previously used for fully random hashing, can be extended to double hashing. This explains why the empirical results are so similar – the underlying limiting behavior is governed by the same differential equations.
  • Ancillary Lists as a Tool: The concept of "ancestry lists" is crucial for the fluid limit argument. By showing these lists are small, the authors establish a form of asymptotic independence, allowing the fluid limit equations to hold.
  • Witness Trees Adapt: The adaptation of witness tree arguments to handle the dependencies of double hashing demonstrates the robustness of this analytical tool and provides a way to derive O(log log n) bounds.

Key Results

  • Empirical Equivalence: Simulations consistently show that the load distributions and maximum loads for double hashing are virtually identical to those of fully random hashing, with differences falling within expected sampling variance. This holds even for scenarios with higher average loads.
  • Theoretical Equivalence (Fluid Limit): The paper proves that for constant d, i, and T, the asymptotic fraction of bins with load i under double hashing differs from fully random hashing by at most o(1).
  • Maximum Load Bounds: Using witness tree arguments, the paper shows that double hashing achieves a maximum load of O(log log n / log d + O(1)) with high probability, matching the bounds for fully random hashing.

Limitations and Future Work

  • Constant d: The fluid limit analysis and some theoretical results are presented for a constant number of choices (d). Extending these to super-constant d remains an open question.
  • Heavily Loaded Case: The fluid limit analysis is primarily for scenarios where the number of balls is roughly equal to the number of bins. The performance of double hashing in heavily loaded cases (more balls than bins) is not fully explored.
  • Other Applications: While the paper suggests double hashing might offer similar benefits in other areas like cuckoo hashing or error-correcting codes, the fluid limit analysis doesn't directly apply to these, and further research is needed to prove performance equivalence.
  • Practical Implementations: The paper notes that while double hashing is efficient, the exact choice of hash functions and parameters can still matter in practice, especially for very small n.

Summary updated

BibTeX
@inproceedings{mitzenmacher2014balanced,
  author = {Michael Mitzenmacher},
  title = {{Balanced allocations and double hashing}},
  booktitle = {SPAA},
  year = {2014},
  doi = {10.1145/2612669.2612684},
}
Figure