How do I benchmark performance of external DNS lookups?

Solution 1:

You can just simply dig and grep

$ dig @ | grep "Query time:"
;; Query time: 15 msec
$ dig @ | grep "Query time:"
;; Query time: 289 msec

Solution 2:

Use GRC's Domain Name Speed Benchmark.

Solution 3:

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.

Solution 4:

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

cat >
#!/usr/bin/env ksh

if [ ! -f "$IPfile" ] || ! echo "$samples"|egrep -q "[0-9]+" ; then
  echo " <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

typeset -i i

while [ $i -lt $samples ]; do
  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\"`

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}'

./test_dns_list_speed server_list 20   average   949     min   523     max  2229 ms 20 responses   average   897     min   515     max  2017 ms 20 responses  average  1235     min   530     max  3362 ms 20 responses         average   759     min   529     max  1624 ms 20 responses

Solution 5:

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