[Pdns-users] Recursor: NS selection logic, multiple IPs in forward-zones statement

Otto Moerbeek otto at drijf.net
Thu Nov 10 20:13:29 UTC 2022

On Wed, Nov 09, 2022 at 09:00:12PM +0300, Andrey Vishnyakov via Pdns-users wrote:

> Hi!
> What is the logic of pdns recursor choosing NS server when multiple items
> are available like multiple IP addresses in a forward-zones statement?
> Looking through the source code I see that NS servers are being ordered by
> speed or response time (usec).  What is the overall algorithm? How often
> resolver does a probing of multiple NS, etc.? Can we somehow configure this
> logic?
> Best regards,
> Andrey

This is briefly described in


It applies to both selecting a forwarder and selectin an authoritative

The recursor computes an exponentially weighted moving average per IP,
and it will use the fastest IP available from all candidates,
processes the new response time to compute a new average response time
for that IP.

Over time, the average values for all IP will be reduced, so that
unused IPs will be used again because they have lower average value,
which will result in a new avaraged response time value for those IP.

This mechanism cannot be tuned or modified.


More information about the Pdns-users mailing list