[Pdns-users] SLAVE refresh performance

Klaus Darilion klaus.mailinglists at pernau.at
Mon Sep 12 13:27:31 UTC 2011



Am 09.09.2011 15:20, schrieb Klaus Darilion:
> Hi!
> 
> I have PDNS 3.0 in a slave setup (not even answering queries, just
> fetching zones and writing them into a postgresql database).
> 
> Currently ~10 000 zones are configured. Every slave-cycle-interval=60
> PDNS checks if the "refresh" is expired, thus causing 10 000 SOA
> queries, taking around 5 seconds.

Seems like PDNS' slave zone checking is quite inefficient:

1. get the list of configured slave zones: "info-all-slaves-query"

select id,name,master,last_check,type from domains where type='SLAVE'

2. get "refresh" from SOA of all these domains:

select content,ttl,prio,type,domain_id,name, case when auth then 1 else
0 end as auth from records where type='SOA' and name=E'foo.bar'

3. calculate for every zone if zone should be refreshed

if (last_check + refresh < time(0)) ...


IMO it would be much more efficient if the calculation would be done
when updating the domains table (instead of updating last_check also
update a additional 'next_check' column).

Thus, changing the "info-all-slaves-query" from:

  select id,name,master,last_check,type from domains where type='SLAVE'

to (Postgresql syntax)

  select id,name,master,last_check,type from domains where type='SLAVE'
and last_check!=NULL and next_check < EXTRACT(EPOCH FROM NOW());

Of course the next_check column must be updated too on SOA-Checks/AXFR.
As long as PDNS doesn't to that, we can work around it by having an
update-trigger on the domains table, which updates 'next_check' on
'last_check'-updates.

I think this should work fine without any side-effects.

Of course it would be more efficient if this could be implemented in the
"update-lastcheck-query" (you can see this as a feature request :-)

regards
Klaus



More information about the Pdns-users mailing list