-
Notifications
You must be signed in to change notification settings - Fork 904
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: Ring buffers sharding #6191
Conversation
e9847be
to
defad9d
Compare
defad9d
to
838302b
Compare
Cleaned up the code, could still use a review! |
9b253c0
to
61bb909
Compare
Rebased to fix a conflict. Added unit tests and some optional locking statistics. |
61bb909
to
6ab62aa
Compare
Rebased to fix a conflict with #6327. |
6ab62aa
to
4100fce
Compare
Rebased so the rec tests pass, and be a little more permissive in the new unit tests because Travis is slow. |
4100fce
to
f208897
Compare
Rebased to fix conflicts. |
39add17
to
a52e381
Compare
Rebased, moved to C++11-style loops for walking the ring buffers as suggested by @chbruyand (thanks!). |
e2daf47
to
58d85f5
Compare
Rebased to fix conflicts. |
Tests failure is unrelated (CDB issue in the auth's tests). |
pdns/dnsdist-rings.cc
Outdated
ReadLock rl(&queryLock); | ||
for(const auto& q : queryRing) | ||
s.insert(q.requestor); | ||
for (auto& shard : d_shards) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add const
to the shard
reference in all of your loops against d_shards
(not in dnsdist-rings.hh
) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would except I can't because I'm locking the mutex. I could make it mutable but that doesn't seem right here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you are doing so at other places : https://github.com/PowerDNS/pdns/pull/6191/files#diff-e0b6a2a362016b3cf6c829a519bad721R265
if (numberOfShards < d_numberOfShards) { | ||
throw std::runtime_error("Decreasing the number of shards in the query and response rings is not supported"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make sure the newCapacity / numberOfShards
ratio is coherent ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may reduce the size of the indivual rings and have some strange behaviour regarding d_nbQueryEntries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, that's why it's only allowed at configuration time and not at run-time. I could write a few words about that here as well though.
pdns/dnsdist-lua-inspection.cc
Outdated
} | ||
else { | ||
unsigned int lab = *labels; | ||
for(auto a : shard->respRing) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe auto& a
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't because we modify the name
member by calling DNSName::trimToLabels()
on it below. We could consider only copying the DNSName
instead of the whole entry, but I'm not sure it would make a noticeable difference. It might worth benchmarking it, or simply doing it.
Suggested by @chbruyand (thanks!).
58d85f5
to
b4b213d
Compare
I pushed a few commits addressing @chbruyand's comments (thanks!). |
Short description
I did test this code, but I had to rebase it to be able to open a pull request against the current master and the rebase was a bit painful, so please don't merge this before I can find the time to test it more.
Combining #6190 and this PR allowed me to reach a bit more than 1M qps with a single
dnsdist
process at almost 100% cache hit rate and in a very controlled lab environment, so YMMV.Checklist
I have: