A small DNS latency test

Do you have any idea what the latency of your DNS queries is? The question just popped into my mind and decided to do a quick experiment. Here are the results for the different servers I have at my disposal here at home. The first query is for a domain the server doesn't have in its cache and the second query is for the same URL, so we know for sure that the answer is cached. The following numbers are just a subset of the measurements I did, but they are very representative of the whole. Let's have a look...

 # OpenDNS
dig knocksox.com @208.67.222.220|grep time    ; Query time: 216 msec
dig knocksox.com @208.67.222.220|grep time    ; Query time: 43 msec  

# One of my ISP's dns caches
dig knocksox.com @62.58.50.20|grep time        ; Query time: 185 msec
dig knocksox.com @62.58.50.20|grep time        ; Query time: 34 msec

# ADSL modem configured using 2 off my ISP's dns servers  
dig knocksox.com @192.168.10.1|grep time      ; Query time: 187 msec
dig knocksox.com @192.168.10.1|grep time      ; Query time: 34 msec 

# OpenWRT wireless router running djbdns dnscache in
# forwarding only mode using all 5 of my ISP's dns servers
dig knocksox.com @10.1.1.1|grep time        ; Query time: 190 msec
dig knocksox.com @10.1.1.1|grep time        ; Query time: 2 msec

# laptop running djbdns dnscache in recursive mode
dig knocksox.com @127.0.0.1|grep time        ; Query time: 201 msec
dig knocksox.com @127.0.0.1|grep time        ; Query time: 0 msec 

Notes:

  • These measurements were made on a laptop connected with a 11g wireless connection to the router.
  • My internet connection is 20mbit/1mbit.

 
Conclusions:

  • OpenDNS servers are have a bigger latency than my ISP's servers, but unless you do anything more than websurfing and downloading, you won't notice the difference. This is nice.
  • The modem does not do any caching whatsoever. That sucks. That means that it is a good idea to have a local cache running behind the modem.
  • The OpenWRT caching solution works very nicely, as expected.
  • If you compare the OpenWRT machine to the laptop you can conclude that running a recursive dns cache does not yield a noticable latency compared to running a forward-only cache. I had expected that a forwarding-only cache would be much faster than a recursive cache. The reason for this is that a forwarding-only setup would have the actual lookups done be a remote, well connected, heavily used (=well filled cache) machine in a hosting centre. This surprises me.