Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: Add bounded loads to the consistent hashing policy #8567

Merged
merged 2 commits into from Jan 6, 2020

Conversation

rgacogne
Copy link
Member

@rgacogne rgacogne commented Nov 21, 2019

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 the whashed one.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

Copy link
Member

@chbruyand chbruyand left a comment

This could be useful to also implement that for whashed policy, maybe remove the closes #7387 comment ?

pdns/dnsdist.cc Outdated Show resolved Hide resolved
``chashed`` is a consistent hashing distribution policy. Identical questions with identical hashes will be distributed to the same servers. But unlike the ``whashed`` policy, this distribution will keep consistent over time. Adding or removing servers will only remap a small part of the queries.

Increasing the weight of servers to a value larger than the default is required to get a good distribution of queries. Small values like 100 or 1000 should be enough to get a correct distribution.
Copy link
Member

@chbruyand chbruyand Nov 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if it might help to cap weight to a min value (100?) when using consistent hashing-based distribution ?

Copy link
Member Author

@rgacogne rgacogne Nov 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to raise the weight to a minimum of 100 when chashed is in use, yes. It's a bit out of scope for that PR but that's a good idea.

@rgacogne
Copy link
Member Author

@rgacogne rgacogne commented Nov 22, 2019

This could be useful to also implement that for whashed policy, maybe remove the closes #7387 comment ?

True, I edited it.

@rgacogne rgacogne merged commit 0c1ebf7 into PowerDNS:master Jan 6, 2020
27 checks passed
@rgacogne rgacogne deleted the ddist-bounded-chash branch Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants