Abstract
In the "power of $d$ choices" paradigm, items are placed into the least-loaded of $d$ bins, resulting in an exponential improvement in load balancing. While theoretical analyses typically assume fully independent hash functions, practical implementations often utilize double hashing to reduce computational overhead. This paper provides a rigorous proof that double hashing is asymptotically as effective as uniform hashing for balanced allocations. By extending the Lueker-Molodowitch (LM) coupling argument, we demonstrate that the maximum load remains $O(\log \log n / \log d)$ with high probability, matching the performance of ideal random hashing.
Introduction
The "balanced allocations" problem is a cornerstone of randomized algorithms and data structure design. When $n$ items are sequentially placed into $n$ bins, choosing the least-loaded of $d \geq 2$ independent, uniformly random bins reduces the maximum load from $O(\log n / \log \log n)$ to $O(\log \log n / \log d)$. This exponential reduction is critical for distributed systems, hash tables, and load balancers.
However, a significant gap exists between theory and practice. Theoretical proofs generally rely on the assumption of "fully random" hashing, where each of the $d$ choices is independent. In practice, generating $d$ independent hash values is computationally expensive. Instead, developers frequently employ double hashing, where two initial hash values $f(x)$ and $g(x)$ generate a sequence of probes: $(f(x) + ig(x)) \pmod n$ for $i = 0, \dots, d-1$. While empirical data and fluid limit models suggested that double hashing performs well, a formal proof using a coupling argument—providing a step-by-step comparison to the ideal case—was previously missing for this specific setting.
Methodology: The Coupling Argument
The primary contribution of this work is the adaptation of the LM argument (Lueker and Molodowitch), originally developed to analyze open addressing in hash tables. The challenge lies in the inherent bias of double hashing; because choices follow an arithmetic progression, they are not truly independent.
Modified Random Hashing
To bridge the gap between double hashing and uniform randomness, the paper introduces an intermediary process termed Modified Random Hashing. In this model:
- With a small probability (specifically $n^{-0.4}$), a ball is placed in a completely random bin.
- In all other cases, the standard "pick the best of $d$ choices" rule is applied using uniform randomness.
Stochastic Domination
The author utilizes Martingale bounds, specifically the Azuma-Hoeffding inequality, to prove that the load distribution under double hashing is "stochastically dominated" by this modified random process. The proof demonstrates that any deviations or "bad luck" resulting from the structured nature of double hashing are sufficiently rare. These errors are effectively overwhelmed by the tiny injection of extra random balls in the modified model, ensuring the overall load distribution remains stable.
Key Insights
The analysis relies on several critical observations:
- Tail Behavior: The bias introduced by double hashing only becomes significant in bins that are already heavily loaded. In a balanced allocation scheme, these bins are rarely selected, meaning the "errors" in the approximation do not accumulate to a degree that affects the global maximum load.
- Algebraic Requirements: The proof assumes that the number of bins $n$ is prime (or that the step size $g(x)$ is relatively prime to $n$). This ensures that the probe sequence can potentially cover all bins, a standard requirement for the functionality of double hashing.
Results and Performance
The paper rigorously establishes that double hashing achieves the same asymptotic performance as ideal uniform hashing:
- Maximum Load: The maximum load is proven to be $\frac{\log \log n}{\log d} + O(1)$ with high probability.
- Distributional Match: The fraction of bins containing at least $i$ items follows the same family of differential equations as the fully random case.
- Asymptotic Negligibility: The bias inherent in using only two hash functions to generate $d$ choices vanishes as the number of bins $n$ approaches infinity.
Limitations and Future Directions
While this work solidifies the theoretical foundation for double hashing in balanced allocations, the coupling argument used here has limitations. The logic relies on the fact that an insertion's effect is localized to a single bin.
This "localization" is not present in more complex schemes like Cuckoo hashing or "peeling" algorithms, where inserting an item can trigger a cascade of movements among existing items. Such cascading changes break the current coupling logic, which requires the ability to "forget" specific choices once an item is placed. Future research may focus on modifying the LM argument to encompass these dynamic multiple-choice schemes.
Summary updated