dnsdist: Add bounded loads to the consistent hashing policy #8567
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.
Short description
This PR adds support for a bounded-load version of the consistent hashing policy, preventing one server from receiving much more queries than the others, even if the distribution of queries is not perfect.
This "consistent hashing with bounded loads" algorithm is enabled by setting
setConsistentHashingBalancingFactor()
to a value other than 0, which is the default. This value is the maximum number of outstanding queries that a given server can have at a given time, as a ratio of the average number of outstanding queries for all the active servers in the pool.For example, setting
setConsistentHashingBalancingFactor(1.5)
means that no server will be allowed to have more outstanding queries than 1.5 times the average of all outstanding queries in the pool. The algorithm will try to select a server based on the hash of the qname, as is done when no bounded-load is set, but will disqualify all servers that have more outstanding queries than the average times the factor, until a suitable server is found. The higher the factor, the more imbalance between the servers is allowed.Implements the
chashed
part of #7387, not thewhashed
one.Checklist
I have: