]> git.ipfire.org Git - thirdparty/pdns.git/commit
Reduce systemcall usage in protobuf logging 7428/head
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 29 Jan 2019 11:15:21 +0000 (12:15 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 29 Jan 2019 14:54:00 +0000 (15:54 +0100)
commitda71b63b1e67d89575ffc47ec1336928e7d903eb
treef6a25dc5bf91ea640554af70166ed8f961c13f27
parent9817af56b5f14c7e488f0531beeda9da978b9c20
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.
pdns/dnsdist-lua-bindings.cc
pdns/namespaces.hh
pdns/pdns_recursor.cc
pdns/remote_logger.cc
pdns/remote_logger.hh