DNS performance: Does having multiple secondary NS servers improve performance?
I will reuse the example from here https://serverfault.com/questions/130608/when-is-a-secondary-nameserver-hit/130625#130625
Basicly it depends on resolver implementation. Some resolvers hits the first server, other resolves will randomly pick a server from those availible. To get around this most DNS servers randomize the order of the replies.
If you ask for google.com you get the following answer:
#dig NS google.com
;; QUESTION SECTION:
;google.com. IN NS
;; ANSWER SECTION:
google.com. 297286 IN NS ns3.google.com.
google.com. 297286 IN NS ns2.google.com.
google.com. 297286 IN NS ns4.google.com.
google.com. 297286 IN NS ns1.google.com.
;; ADDITIONAL SECTION:
ns1.google.com. 297067 IN A 216.239.32.10
ns2.google.com. 297074 IN A 216.239.34.10
ns3.google.com. 297074 IN A 216.239.36.10
ns4.google.com. 297067 IN A 216.239.38.10
And then we do it again:
#dig NS google.com
;; QUESTION SECTION:
;google.com. IN NS
;; ANSWER SECTION:
google.com. 297249 IN NS ns3.google.com.
google.com. 297249 IN NS ns2.google.com.
google.com. 297249 IN NS ns1.google.com.
google.com. 297249 IN NS ns4.google.com.
;; ADDITIONAL SECTION:
ns1.google.com. 297030 IN A 216.239.32.10
ns2.google.com. 297037 IN A 216.239.34.10
ns3.google.com. 297037 IN A 216.239.36.10
ns4.google.com. 297030 IN A 216.239.38.10
Notice here how they change the order of the nameservers in the reply to spread out the load.
As far as DNS recursive servers are concerned, there's no difference between "primary" and "secondary" name servers - technically they're both just "authoritative" servers.
The only things that make any difference to the effectiveness of the load balancing are:
- the order that the list of
NS
records is returned by the servers themselves - whether the client then picks one at random anyway
- whether the client uses other heuristics (i.e. round-trip time - RTT) to pick the "fastest" server
Of those factors, the first is the least important. Picking at random and using RTTs is much more common.
IPv4 resolvers will typically use the servers in the order they get them in the packet, with the first one most often succeeding. The order is typically randomized by the DNS server to spread the load. IPv6 will change this, as it requires the IP with the most common topmost bits to be the one contacted first. This will make randomization of the DNS replies meaningless.