Which DNS resolver is better - ISP’s (default) DNS resolver, or Google Public DNS or the pioneer of DNS openDNS or even a local DNS server?
Let’s try to find out! I am sitting on a BSNL data link, and I will try to perform few tests to find that out: Available DNS resolvers to me:
- BSNL DNS resolvers - 220.127.116.11 & 18.104.22.168
- Google Public DNS - 22.214.171.124 & 126.96.36.199
- OpenDNS - 188.8.131.52 & 184.108.40.206
- Local DNS Server - BIND running on localhost - 127.0.0.1
Observing ping time:
BSNL DNS resolver:
--- 220.127.116.11 ping statistics --- 5 packets transmitted, 4 received, 20% packet loss, time 4001ms rtt min/avg/max/mdev = 26.978/27.754/29.122/0.897 ms --- 18.104.22.168 ping statistics --- 5 packets transmitted, 4 received, 20% packet loss, time 4001ms rtt min/avg/max/mdev = 26.978/**27.754**/29.122/0.897 ms
Google Public DNS:
--- 22.214.171.124 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4001ms rtt min/avg/max/mdev = 121.147/121.878/122.951/0.783 ms
--- 126.96.36.199 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms rtt min/avg/max/mdev = 217.678/**219.528**/222.034/1.717 ms
Next, localhost? :)
Pinging local DNS server makes no sense as reply will be in less then 1ms!
Anyways, so here’s ping summary:
- BSNL - 28ms
- Google Public DNS - 122ms
- OpenDNS - 220ms
- Local DNS server - N/A
Next, we will try asking IP address of popular site facebook.com to all of these. Here’s a sample query:
;; QUESTION SECTION: ;facebook.com. IN A ;; ANSWER SECTION: facebook.com. 1022 IN A 188.8.131.52 facebook.com. 1022 IN A 184.108.40.206 facebook.com. 1022 IN A 220.127.116.11 ;; Query time: 28 msec ;; SERVER: 18.104.22.168#53(22.214.171.124) ;; WHEN: Thu Jan 27 13:44:57 2011 ;; MSG SIZE rcvd: 248
We can see, BSNL resolver passed the IP almost instantly for a popular site. Popular here simply means that resolver must be having the record within it’s cache as per TTL of the zone.
Observing resolution time:
Asking for IP of facebook.com to rest of DNS servers, here’s summary:
- BSNL resolver took 28ms
- Google Public DNS took 125ms
- OpenDNS took 219ms
- Localhost took 558ms
We see a very big value from local host here. Reason, it had to find the IP via root DNS servers. In my case, this local DNS resolver used - b.gtld-servers.net (closest) to get Authoritative DNS servers of “facebook.com” and next, it asked those DNS servers for the IP of facebook.com Note: Further anymore queries to facebook.com using local DNS will take almost 0ms for next 1022 seconds as defined in DNS zone of facebook. So for a popular site - clearly BSNL DNS resolver is winner based on responce which is 5 times faster then Google Public DNS and almost 10times faster then OpenDNS. Next, we try to find how much time it takes to resolve a less popular domain - crazybeam.com (less popular = no caching of records at resolver)
Time taken by all resolvers:
- BSNL took 223ms
- Google Public DNS took 398ms
- OpenDNS took 487ms
- Local DNS server took 667ms
As we can see - BSNL resolver took quite more time here but still very low. Local DNS resolver took almost same time to resolve a less popular domain as it took to resolve a popular domain - reasons remains - no caching. So finally, here’s the summary explaining results and recommendation of which resolver to use:
- Google DNS is better then OpenDNS for India since OpenDNS has no mirrors in India. Closest mirror is Singapore, but actually most of data seems being routed from London. Here’s a traceroute for reference.
- Running a local DNS server is good if you have mid-size organization where you have atleast 1000+ users. This will help in building a decent DNS cache which will servce queries instantly apart from saving bandwidth used for DNS lookups.
- Local ISP DNS servers seems very good in initial testing based on very low latency values they give BUT remember - there’s a big problem associated with BSNL DNS resolvers - they do not store most of records till TTL is complete. That is - they perform very good for cached values as we can see, but they seem discarding cached records well before expiry of TTL. This makes them bit poor in performance as this does not happen with Google or openDNS at all. Hence for popular domains, Google takes ~120ms, while BSNL takes 220ms. OpenDNS remains bit slow for India.
- Apart from that, one of other big problems perticularly with BSNL DNS servers is - they constantly time out thus giving high packet loss, and causing “Name not found” errors.
So finally my recommendation - if you are on Indian ISP network, **it’s good to use Google Public DNS.