Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have recently come across the following configuration of /etc/resolv.conf which is/was supposed to increase the speed of DNS resolution:

nameserver 1.1.1.1
nameserver 2.2.2.2
nameserver 3.3.3.3
option rotate 
option timeout:1

I have the "option" flags in mind obviously apart from using 3 DNS servers in the config (usually only two are being used). The first one is supposed to rotate/round-robin across all 3 DNS server and the last one is supposed to set the lookup timeout to 1s (default is apparently 5s). I'm just wondering whether any of you is using this configuration and whether you are seeing any improvements ? Some people are saying that this won't help with the improvements at all but I'm not really sure why.

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

This will make things worse in every case but the case where your first nameserver itself fails. Here's an example of how it makes thing worse:

Say you're trying to resolve a site whose primary nameserver is slow or broken. Normally this happens.

  1. You try your first nameserver.

  2. It tries the site's primary nameserver.

  3. The primary times out.

  4. Your first nameserver tries the secondary.

  5. It gets a response.

  6. You get a response.

But with your change, this happens:

  1. You try your first namserver.

  2. Your first nameserver tries the site's primary nameserver.

  3. You time out.

  4. You try your second nameserver.

  5. Your second nameserver tries the site's primary nameserver.

  6. The first nameserver tries the site's secondary nameserver and gets the answer. Too bad you timed out already.

  7. You time out on the second nameserver.

  8. You try the third nameserver.

  9. Your third nameserver tries the site's primary nameserver.

  10. Your second nameserver has the answer, too bad you timed out already.

  11. You time out on the third nameserver.

  12. Your third nameserver has the answer, but you aren't listening anymore.

You are timing out way too soon and are very likely to give up just before the namserver gets the answer, only to repeat the process. On the bright side, now all your nameservers have the result in their cache.

share|improve this answer
    
+1 just for On the bright side, now all your nameservers have the result in their cache.. Anyway, excellent breakdown of the effect of reducing the timeout too much. –  Bob Apr 27 '12 at 11:46
    
DNS has no concept of "primary name servers" for a domain. There is the primary as named in the SOA, but I can't imagine any sane resolver relies on that. NS RRs are already round-robin'ed both from the parent zone as well as the authoritative server that responds and any caches in between (I think there's a BIND option to disable this behavior). To some degree, DNS has a concept of master and slave servers, but that has nothing to do with which server is queried first, only where changes are primarily made (c.f. hidden/private master setups). Resolvers may be and often are different. –  Michael Kjörling Apr 27 '12 at 12:57
    
@MichaelKjörling By "primary" I just mean the one returned first. While round robin is the norm, it is not universal. (And even if it was, it would just take bad luck to hit the bad one first more than once.) –  David Schwartz Apr 27 '12 at 18:15
add comment

My way to improve DNS performance:

  1. Run namebench to find the fastest DNS provider for you.
  2. Done.

To my knowledge, there is no magic, local configuration to improve the speed of DNS queries. But I'm hardly an expert on the topic.

share|improve this answer
add comment

IIRC, it takes two seconds by default for the first tried DNS server to timeout before trying the next one in the list if there is no response. Therefore, it looks like the last option will reduce the timeout to one second before trying the next one on the list.

The other option to rotate which DNS server it tries first will only be of benefit if they are all as fast as eachother and you are trying to load balance requests.

I would use namebench, as Oliver has mentioned, to figure out how fast each one is and put them in the list in order of speed and delete the rotate option, unless they are as fast as eachother.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.