How do I benchmark performance of external DNS lookups?
Solution 1:
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
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 >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
Solution 5:
I also took a look at namebench - Google's Open Source DNS Benchmark Utility. It was very comprehensive.