feat: add a rendezvous hash implementation - #9
Draft
tstirrat15 wants to merge 1 commit into
Draft
tstirrat15 wants to merge 1 commit into
tstirrat15 wants to merge 1 commit into
Conversation
tstirrat15
force-pushed
the
tstirrat/add-rendezvous-hash-implementation
branch
from
October 2, 2026 19:44
67e328f to
6e34846
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Written with LLM assistance.
In SpiceDB we use consistent hashing to route the the same dispatch key to the same SpiceDB node, which theoretically increases cache hit rate and reduces hotspotting. Consistent hashing assumes a relatively stable set of nodes, because the hashring is precomputed and recomputing the hashring is expensive. An upside of precomputation is that routing an individual request is cheap.
This causes problems when nodes enter or leave the cluster, however. This whole saga started when we opened #5, and since then we've put through a couple of PRs (#4, #8) intended to address the problem of a node going unreachable but the routing logic not responding quickly.
Rendezvous hashing is a different approach to the same problem, where a hash of the key is combined with a hash of the node identity for each node, and the largest resulting number is the node that's routed to. Because it's computed on every request and is based on simple ordering, the cost of nodes entering or leaving is relatively small, and load is relatively evenly redistributed immediately.
There are other variants of it (skeleton hashing, CRUSH) that can offer better performance when there are large numbers of routable nodes (think a CDN) or multiple layers to the network structure, but neither of those apply for SpiceDB, where a large cluster might be 32 nodes.
This implements a rendezvous hashing strategy which can be configured at runtime. We'll need to run this against actual workloads to compare its behavior.
Changes
Testing
Review. Pull into a build of SpiceDB and observe its behavior.