2009/12/04

Is 8.8.8.8 Faster Than What You Are Using?

Nerds and bloggers had a huge geekgasm yesterday as Google introduced its Public DNS. Coming from Google, with a very sexy IP I must add, you are by religion obliged to switch over, right? It depends...

Let's experiment with the dig (with one g) command line utility. With help of dig you can query any DNS server for a specific domain. Just fire up your terminal and type for e.g. dig @8.8.8.8 google.com. That command queries the DNS server with IP 8.8.8.8 (the Google DNS server) to resolve google.com to an IP address. You should get something like this as output:


$ dig @8.8.8.8 google.com

; <<>> DiG 9.6.0-APPLE-P2 <<>> @8.8.8.8 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44616
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;google.com. IN A

;; ANSWER SECTION:
google.com. 300 IN A 74.125.53.100
google.com. 300 IN A 74.125.67.100
google.com. 300 IN A 74.125.45.100

;; Query time: 39 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Dec  4 22:57:35 2009
;; MSG SIZE  rcvd: 76



So google.com has 74.125.45.100 74.125.67.100 and 74.125.53.100 as IPs. But most importantly what we are after is the query time: 39 msec. Is that fast? Let's compare it with other DNS servers.

In my tests I used two DNS servers from the two major ISPs from Romania, the sexy DNS server 8.8.8.8 and one of the DNS servers of OpenDNS. I looked up 3 different domains 100 times. Between the lookups I waited 30 seconds for the DNS servers' caches to clear a bit. For each domain lookup test I wrote a separate shell script. The shell script testing the DNS servers for wikipedia.org looks like:

#!/bin/bash

domain="wikipedia.org"

nameservers[0]="193.231.236.17"         # RDS
nameservers[1]="193.231.100.130"        # Romtelecom
nameservers[2]="8.8.8.8"                # Google
nameservers[3]="208.67.220.220"         # OpenDNS

iterations=100
sleeptimesecons=30

rm DNSQueryResults$domain.txt
for (( i=0;i<$iterations;i++ )); do
        echo "iteration count: $i"
        for (( j=0;j<4;j++ )); do
                echo -ne "`dig @${nameservers[$j]} $domain | grep ';; Query time:' | cut -d" " -f4`\t" >> DNSQueryResults$domain.txt
        done
        echo >> DNSQueryResults$domain.txt # newline
        sleep $sleeptimesecons
done

After formatting the data into a human readable format in an OpenOffice spreadsheet the charts are (my apologies for the colorblind):








Conclusion

Is it worth switching to Google's DNS servers?
 - yes IF your ISP provides you a very slow DNS server. Just look at RDS's DNS server response times in the charts. In case you were wondering I was on RDS's network during the testing.
- no IF your ISP provides you a decent DNS server that has a good cache policy because it will always have a better response time since you are physically closer to the DNS server (less hops till your IP packet reaches it) unless it is overladed

Bonus question: Is it worth switching over from OpenDNS to Google?
Currently OpenDNS provides a ton of extra features that Google currently doesn't e.g. content filtering at DNS level, botnet/malware protection, network shortcuts, etc. From the tests on average OpenDNS's DNS server response was a bit slower (by ~17 msec) than of Google's. Until Google coughs up some neat features for it's DNS service or it will be considerably faster than of OpenDNS my answer would be NO.

Want to reproduce the test at your machine? Just use the shell script and don't forget to post here your results in the comments.

0 comments:

Post a Comment