[Pdns-users] High CPU load with no traffic

abang abang at t-ipnet.net
Tue Dec 16 06:57:56 UTC 2014


Hi Ciro,

> https://iriarte.it/?p=354
> Testing & suggestions are welcome!

Consider if it isn't more efficient to open the database outside from a
function. This is cheaper because this way it must only open once at
startup or at "rec-control reload-lua-script":

cdb = require("cdb")
db = assert(cdb.open("/var/lib/powerdns/blacklist.cdb"))
function preresolve ( remoteip, domain, qtype )
...

Furthermore you should be aware of the "0x20-Bit encoding"
(upper/lowercase) in queries to find it in your database:

domain = string.lower( domain )

And it is always safer to limit a loop:

local i = 0
while domain ~= "" and i < 100
   i = i + 1
   ...


Winfried




More information about the Pdns-users mailing list