17

I'm considering Google's public DNS servers as the external DNS for my network. Currently I'm using the DNS servers from my ISP. I've also considered OpenDNS in the past, but ultimately decided not to jump.

I'd like to be able to benchmark how quickly the respective servers are able to serve our DNS requests. I see nothing in nslookup that would help.

How can I test the round-trip times for externally provided DNS?

Mike L
  • 328
  • 1
  • 2
  • 9

10 Answers10

43

You can just simply dig and grep

$ dig @8.8.8.8   www.rimuhosting.com | grep "Query time:"
;; Query time: 15 msec
$ dig @4.2.2.1   www.rimuhosting.com | grep "Query time:"
;; Query time: 289 msec
krisanalfa
  • 103
  • 4
Pascal
  • 431
  • 3
  • 2
13

Use GRC's Domain Name Speed Benchmark.

nrgyz
  • 550
  • 2
  • 9
  • I checked out this tool... it rocks! – Mike L Dec 04 '09 at 19:08
  • 2
    I tried GRC's Benchmark after running Google's namebench. Google's said it's own 8.8.4.4 was 21.1% faster than other's. However GRC's customized list w/added 8.8.4.4 showed google's was one of the slowest and only marginally faster than my current DNS provided by Comcast. The fastest were all from Level 3 Communications. I trust GRC's DNS Benchmark over Google's now. And GRC's is written in assembly and runs from a single 184k file. Impressive! – Brian Boatright Feb 09 '12 at 04:58
  • Be wary of GRC's if you're not in the USA. It doesn't seem to test many (any?) non-USA hosted servers. – NickG Jul 12 '17 at 13:36
5

I wrote little nice script to evaluate connection to DNS servers:

cat >test_dns_list_speed.sh
#!/usr/bin/env ksh
site="www.google.com"
IPfile="$1"
samples=$2

if [ ! -f "$IPfile" ] || ! echo "$samples"|egrep -q "[0-9]+" ; then
  echo "test_dns_list_speed.sh <file-ip-list> <samples>"
  echo "<file-ip-list>       newline separated list of DNS server IP adresses"
  echo "<samples>            how many DNS resolution samples to take"
  echo "PURPOSE:"
  echo "          collect statistics about response times from list of DNS servers"
  exit 1
fi

typeset -i i

while [ $i -lt $samples ]; do
  i=$i+1
  for IP in `cat $IPfile`; do
    time=`dig @$IP $site| awk '/Query time:/ {print " "$4}'`
    IPtrans=`echo $IP|tr \. _`
    eval `echo result$IPtrans=\"\\$result$IPtrans$time\"`
  done
done

for IP in `cat $IPfile`; do
  IPtrans=`echo $IP|tr \. _`
  printf "%-15s " "$IP"; echo -e `eval "echo \\$result$IPtrans"`|tr ' ' "\n"|awk '/.+/ {rt=$1; rec=rec+1; total=total+rt; if (minn>rt || minn==0) {minn=rt}; if (maxx<rt) {maxx=rt}; }
             END{ if (rec==0) {ave=0} else {ave=total/rec}; printf "average %5i     min %5i     max %5i ms %2i responses\n", ave,minn,maxx,rec}'
done

./test_dns_list_speed server_list 20
202.93.142.10   average   949     min   523     max  2229 ms 20 responses
202.93.142.20   average   897     min   515     max  2017 ms 20 responses
208.67.222.222  average  1235     min   530     max  3362 ms 20 responses
8.8.8.8         average   759     min   529     max  1624 ms 20 responses
PeZa
  • 51
  • 1
  • 1
5

You can use a packet capture program (filtering for DNS) to track the DNS query\response times. You can run this on your machine or on your internal DNS server (if you have one). All things being more or less equal, this should give you a general idea of how quickly Google DNS is compared to your ISP.

joeqwerty
  • 108,377
  • 6
  • 80
  • 171
  • 5
    Wireshark's DNS dissector does request/response tracking. The "dns.time" display filter can be used to find the response time. – Gerald Combs Dec 14 '09 at 16:28
3

I also took a look at namebench - Google's Open Source DNS Benchmark Utility. It was very comprehensive.

Mike L
  • 328
  • 1
  • 2
  • 9
  • link expires :-( – Pol Hallen Sep 21 '16 at 20:26
  • The version of namebench linked to (v1.3) is pretty old now. There's an updated (v2) repository on GitHub: https://github.com/google/namebench which supports DNSSEC, CDN benchmarking etc. – Patrick Jul 25 '19 at 00:33
2

I have done some basic benchmarks between OpenDNS and GoogleDNS. The results suggest that the OpenDNS offering is consistently faster than Google's DNS service:

http://ajclark.wordpress.com/2009/12/04/google-dns-vs-opendns-performance-comparison/

2

Firebug plugin for Firefox and IE has a "net" tab that gives you a graphical representation of load time for every file request.

It breaks it down into activity including DNS lookups, which are shown in green.

Nexus
  • 850
  • 1
  • 8
  • 19
2

The simple shell script qtest.sh can be used for that:

% qtest -n3 "A a.gtld-servers.net" 172.19.1.1 62.4.16.70 62.4.17.69 208.67.222.222 208.67.220.220 156.154.70.1 156.154.71.1  
3 172.19.1.1/172.19.1.1
49 62.4.17.69/62.4.17.69
61 208.67.222.222/208.67.222.222

Here, 172.19.1.1, a local resolver, is faster, followed by the ISP resolver, then OpenDNS.

bortzmeyer
  • 3,903
  • 1
  • 20
  • 24
1

You can use ping to figure out how long it would take for a packet to move back and forth between your server and the DNS servers. As a general rule: never change what works.

A disadvantage to OpenDNS is that domains that do not exist may respond with an A record pointing to OpenDNS's search page, as they tend to do that. Google doesn't currently do it, but it would be foolish to assume they are simply providing DNS resolvers with nothing to gain from it.

gekkz
  • 4,219
  • 2
  • 20
  • 19
  • If I could have split an answer, I would have. I liked the ping test for it's simplicity. I could let it run against all of them, then look at the averages. Here, I wanted to look at the response times for the query itself in addition to the round trip for the packets, so I opted for the packet capture. More work to set it up and test, but more exacting for the true performance of the external server. Thanks! – Mike L Dec 04 '09 at 16:39
  • 1
    Bad idea to use ping. Not all servers respond to ping and there is zero guarantee that the response time will be the same with DNS and with ICMP. – bortzmeyer Dec 17 '09 at 11:30
1

dnseval from dnsdiag works like a charm on windows linux and mac. (much better than the outdated namebench) download on github

To use it, first write a text file that each DNS you want to testcontains a line with its IP adress: mylist.txt:

8.8.8.8
192.168.178.1

and then run

./dnseval -f mylist.txt yahoo.com     # latency for cached sites
./dnseval -m -f mylist.txt yahoo.com  # latency for sites not in cache

While this does not inspect that cache size of the servers, it is a much easier and faster approach and I expect it to correlate well with real world performance.

jan-glx
  • 113
  • 4