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: Merge the 'main' and 'client' DoH threads in single acceptor mode #12386

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

rgacogne
Copy link
Member

@rgacogne rgacogne commented Jan 6, 2023

Short description

When we are in "single acceptor thread" mode, merge the 'main' and 'client' DoH threads into a single one. We use separate threads to reduce the separate the handling of the HTTP/2 traffic from the DNS handling, to reduce latency, but that does not really make sense on small devices with a single, limited CPU core. On these we prefer using as few threads as possible to reduce the context switches and the memory usage.

Note that this pull request builds on #12383 and will have to be rebased.

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)

When we are in "single acceptor thread" mode, merge the 'main' and
'client' DoH threads into a single one. We use separate threads to
reduce the separate the handling of the HTTP/2 traffic from the DNS
handling, to reduce latency, but that does not really make sense on
small devices with a single, limited CPU core. On these we prefer
using as few threads as possible to reduce the context switches and
the memory usage.
@rgacogne rgacogne marked this pull request as ready for review January 11, 2023 13:52
{
// if there was no EDNS, we add it with a large buffer size
// so we can use UDP to talk to the backend.
auto dh = const_cast<struct dnsheader*>(reinterpret_cast<const struct dnsheader*>(du->query.data()));
Copy link
Member

Choose a reason for hiding this comment

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

Just to be sure, do we already know that data() is at least the size of a dnsheader at this point (otherwise we would not hit that point) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, otherwise it would have been discarded at the beginning of doh_dispatch_query.

@rgacogne rgacogne merged commit dfa605c into PowerDNS:master Jan 13, 2023
@rgacogne rgacogne deleted the single-doh-acceptor branch January 13, 2023 15:50
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.

2 participants