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

Reduce systemcall usage in protobuf logging #7428

Merged
merged 1 commit into from Jan 30, 2019

Conversation

Projects
None yet
2 participants
@ahupowerdns
Copy link
Member

commented Jan 29, 2019

Since Spectre/Meltdown, system calls have become more expensive. In
addition, relevant versions of glibc turn out to implement pthread_cond_wait
and pthread_cond_signal in such a way that they use multiple system calls always.
There is an optimization in glibc to improve this but it is disabled.

This new setup changes our protobuf logging so it amortizes system calls so we perform
far less than one call per message.

Note that our previous RemoteLogger was configured in terms of how many
messages it would buffer. Our new code is configured in terms of how many
bytes. I have multiplied the configured numbers by 100 elsewhere (recursor
config, dnsdist config) to sort of maintain parity.

In addition, the old RemoteLogger would buffer messages while there was no
connection available. We no longer do this.

Finally new, every 'reconnectTimeout' seconds we will flush our buffers
opportunistically to not keep people waiting.

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)
  • checked that this code was merged to master

@ahupowerdns ahupowerdns requested a review from rgacogne Jan 29, 2019

@rgacogne
Copy link
Member

left a comment

Code looks very good, just a few nits. I feel a bit bad about not buffering messages in case of reconnection or TCP congestion, but I don't have a better way.

Show resolved Hide resolved pdns/namespaces.hh Outdated
Show resolved Hide resolved pdns/remote_logger.cc
Show resolved Hide resolved pdns/remote_logger.hh Outdated
Reduce systemcall usage in protobuf logging
Since Spectre/Meltdown, system calls have become more expensive.  In
addition, relevant versions of glibc turn out to implement pthread_cond_wait
and pthread_cond_signal in such a way that they use multiple system calls always.
There is an optimization in glibc to improve this but it is disabled.

This new setup changes our protobuf logging so it amortizes system calls so we perform
far less than one call per message.

Note that our previous RemoteLogger was configured in terms of how many
*messages* it would buffer. Our new code is configured in terms of how many
*bytes*. I have multiplied the configured numbers by 100 elsewhere (recursor
config, dnsdist config) to sort of maintain parity.

In addition, the old RemoteLogger would buffer messages while there was no
connection available. We no longer do this.

Finally new, every 'reconnectTimeout' seconds we will flush our buffers
opportunistically to not keep people waiting.

@rgacogne rgacogne force-pushed the ahupowerdns:redo-remotelogger branch from bdc128d to da71b63 Jan 29, 2019

@rgacogne rgacogne referenced this pull request Jan 29, 2019

Merged

rec-4.1.x: Reduce systemcall usage in protobuf logging #7430

4 of 8 tasks complete

@ahupowerdns ahupowerdns merged commit a3b016b into PowerDNS:master Jan 30, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@rgacogne rgacogne referenced this pull request Apr 10, 2019

Open

all: DNSName, speeds up toString() conversion #7699

3 of 7 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.