Mark Zealey [Mon, 2 Dec 2013 09:19:24 +0000 (11:19 +0200)]
fixes PowerDNS/pdns#692
For the second time when writing a backend I forgot that an ANY query needs to return any SOA data as well. This is because we store our SOA's separately from our other DNS data in order to optimize zone lookups. According to Habbie MyDNS backend has the same bug. The attached patch basically forces an SOA to be included which is actually much more optimal than anything I can do in my backends as I don't have easy access to the knowledge of:
* sd data structure;
* is this query also an SOA
meaning that if I answer it in the backend I have to do a number of additional lookups for information that is already available in the PacketHandler. Additionally, I notice that you are basically doing all the SOA setup anyway if there is anything looking like an SOA entry. So, all this patch does is strip out any SOA entries and then insert one if there should be. This seems to me to both potentially simplify backend code and fix up any user errors more accurately than the current code does.
Mark Zealey [Mon, 2 Dec 2013 09:12:46 +0000 (11:12 +0200)]
fixes PowerDNS/pdns#666
SO_REUSEPORT is available on various bsd operating systems as standard, and also as a linux kernel patch from Google. It allows
1) Running 2 powerdns processes concurrently so that you can restart powerdns without loosing any packets
2) (the main purpose for my writing this patch) On linux with a patched kernel removes contention from many threads using a socket. In my tests this improves performance with a packet cache from 300kqps to 1mqps
If the SO_REUSEPORT call is available, the attached patch causes each receiver thread to open a new socket for connections which allows each thread (on linux) to operate at full speed rather than waiting on a slow socket. It should fail nicely ie if the call is not available at either compile time or run time it will just use the initially created socket.
Was merged in to linux 3.9 series - see https://lwn.net/Articles/542629/ for more information
Mark Zealey [Mon, 2 Dec 2013 09:07:00 +0000 (11:07 +0200)]
fixes PowerDNS/pdns/#661
I was doing some performance testing on our 32-way servers and discovered that in the simple case where the test program returns the data straight away, about 80% of the time was being spent in the kernel in a spinlock. I've been debugging this looking at the coprocess code and discovered that this is due to the following line in coprocess.cc:
setbuf(d_fp,0); // no buffering please, confuses select
If this is removed, performance in my particular test case goes from 2000qps with powerdns running at about 2000% cpu to 10000qps with powerdns using about 300% cpu.
Obviously the comment implies that this is not a permanent solution, I guess if the timeout is specified as 0 then the select code won't be executed and so you can disable the setbuf easily enough. However perhaps if the timeout is wanted you could set an alarm() rather than using select?
Stefan Bühler [Mon, 18 Nov 2013 19:04:25 +0000 (20:04 +0100)]
fix bindparser reduce conflicts
resolve reduce conflicts to what yacc defaulted to:
* 'root_command' included 'command' directly and through
'options_command' and 'zone_command'; separate option/zone commands
for global usage, which don't include 'command' anymore.
* 'command' included 'also_notify' and 'zone_also_notify'; yacc resolved
conflict by defaulting to 'also_notify'; removed 'zone_also_notify'
from global zone commands.
Kees Monshouwer [Sun, 17 Nov 2013 19:36:23 +0000 (20:36 +0100)]
remove unreferenced files from source tree
for FILE in $(git ls-files pdns/*); do
git grep $(basename "$FILE") > /dev/null || echo "would remove $FILE"
done
Peter van Dijk [Thu, 7 Nov 2013 13:24:30 +0000 (14:24 +0100)]
avoid uninitialised res variable; don't cache any-to-tcp TC responses; ignore EDNS bufsize on TCP; also apply udp-truncation-threshold to non-EDNS questions