Google DNS Benchmarked

8 Comments

Today Google announced a public DNS service they are hosting. They claim that their DNS infrastructure is faster and more secure, because their servers do some clever things. I wanted to test their performance claims, so I wrote a little script to measure a lookup times for different domains across a number of DNS servers.

Methodology

Firstly I found a list of the 1 million most popular sites. I then picked a number of DNS servers to test against. I chose Google's, OpenDNS's, my ISP (Sky/Easynet) and my old ISP's (Plus.net).

I decided I would query an A record for each of the domains in the list, one at a time, starting with the most popular. I would query each server three times for the same domain name. The ordering was like this:

foreach (domain)
for (i =0; i<3;i++)
foreach (server)
query(server, domain)

I recorded the time it took for each query to be answered, and I also recorded the replies. I was curious to see if some servers replied with different answers, or if some returned more information, i.e. additional records.

I wrote a script in PHP 5.3, and ran it from the command line on my Windows Server 2008 machine. The script used PEAR's Net_DNS to craft and send the DNS questions. I was not using my operating system's resolver, and I was not using any form of client side caching. I ran the experiments from my home ADSL connection and as far as I know my ISP was not interfering with my DNS requests in any way. I live in the North West of the UK.

Results

After letting this run for a few hours, and querying roughly the top 10,000 domains, I have some preliminary results.

DNS ServerMin (ms)Max (ms)MedianMean (ms)Standard Dev (ms)
Google A (8.8.8.8)38.50493242.45122.8181.6
Google B (8.8.4.4)38.65492741.8494.52154.8
OpenDNS A (208.67.222.222)29.77403531.8774.37115.4
OpenDNS B (208.67.220.220)29.76117131.82 35.2832.4
Easynet A (90.207.238.97)33.90257861.29105.2103.7
Easynet B (90.207.238.99)33.65425344.9696.11104.8
Plusnet A (212.159.11.150)43.78442352.56100.8156.5
Plusnet B (212.159.13.150)38.87499142.7690.78169.1

From this table of results, we can see that Google's median response time is 41-42ms, however, OpenDNS performs much better with a result of ~31ms. Both my current ISP and my old ISP don't perform as well and each achieved a result between 42ms and 61ms. To get a better feel for the data I plotted an empirical CDF of the lookup times for each server.

The first impression I can make from this CDF is that OpenDNS serves far more of the queries faster than anyone else. Secondly the secondary DNS servers all seem to be faster than their primaries. I suspect this is because most hosts query the primary, and rarely query the secondary. I even read that BIND (a popular DNS server) has/had a bug in it which favoured the primary DNS.

The minimum lookup time for each pair of DNS servers seems to be the same, most likely caused by the network latency between me and the servers. Even so, if we normalise all the data by taking the servers' minimum value away from each sample, we still find that OpenDNS performs better than Google, and Google performs slightly better than Plus.net and quite a bit better than my current ISP, Easynet.

Rather worryingly is that the latency to OpenDNS is smaller than the latency to my own ISP's DNS servers. This makes me wonder where the hell my ISP hosts their DNS servers. Also, the ~38ms minimum time with Google indicates that at least some of their DNS servers are hosted in Europe, and possibly the UK.

SInce I ran each lookup three times, I wanted to compare the lookup times for each request. This time I plotted the empirical CDF of each iteration of request.

This CDF seems to show that the 2nd and 3rd requests always get served quicker than the first. In most cases the 2nd and 3rd request have equal ranking, but the first is always slow. This could easily be attributed to the fact that the caching DNS server does not have the record in its cache, and thus must be fetched. The second time I request the domain name (only moments later), the server already has the query, and most likely has it stored in RAM or L1/L2 CPU cache.

OpenDNS_B seems to respond equally quick for the first, second and third request. This could be because I would always query OpenDNS_A first, then move on to B. If A and B were actually the same machine, it would be like sending 6 requests to the machine instead of 3. Therefore, B's 1st request is actually its second. Even if A and B were different machines, there could be some clever replication, or shared caching going on to cause this behaviour.

Finally, I'm surprised that the 2nd and 3rd requests are slower, especially since I'm requesting the most popular domain names. Surely others would have already requested the domain name, and thus the DNS server has no need to fetch it. Looking through the list of domain names I see that none of them have the www prefix. I personally never type the www and just hope the site works, but perhaps many users do. Maybe I should re-run the experiment with the www prefix.

Conclusion

For now I would stick to using OpenDNS, as this is clearly the winner. However, the Google DNS service is very new, so perhaps the servers haven't had enough time to fill their caches, and their admins haven't had enough time to tweak them. I will perhaps rerun this experiment in a few weeks and see what happens.

TODO

I still have some analysis to do, for example, looking at packet loss, the type of records returned, and anything else I can think of.

Martijn

Doesn't this say more about your ISP than the actual performance of the DNS services you tested?

2009-12-07 17:07:18

Alan

Thanks for the graphs and code. I know you can't cover every aspect of the debate in this technical writeup, but there's one factor that some people take offense to: OpenDNS' non-standard behavior (returning hits when no hits are found)! Another thing Google's got going for it is the easy-to-remember IPs :)

Alan

2009-12-07 17:39:35

Matt wolfe

Just curious, what are your average ping response times for each of these dns servers.. I think if you take into account the round trip time that is unavoidable your results might be more thorough.

2009-12-07 18:04:34

bramp

Martijn, it does, but it also gives us some idea how well the different services cache DNS records. For example, OpenDNS must be aggressively caching, so that they can reply quickly to the majority of queries.

Alan, I am well aware that OpenDNS will manipulate the results, but many people (including myself) don't mind this for typical home use. Either way, I felt it was good to compare to, and someone else can write about those kinds of subjective pros and cons.

Matt wolfe, I didn't show the ping response times because ICMP are handled differently to UDP packets, so I thought it wouldn't be fair. Regardless I have now quickly measured pings to each server and I get this result:

8.8.8.8 Minimum = 37ms, Maximum = 39ms, Average = 38ms
8.8.4.4 Minimum = 38ms, Maximum = 39ms, Average = 38ms
208.67.222.222 Minimum = 29ms, Maximum = 30ms, Average = 29ms
208.67.220.220 Minimum = 29ms, Maximum = 29ms, Average = 29ms
90.207.238.97 Minimum = 32ms, Maximum = 32ms, Average = 32ms
90.207.238.99 Minimum = 32ms, Maximum = 33ms, Average = 32ms
212.159.11.150 Minimum = 58ms, Maximum = 85ms, Average = 72ms
212.159.13.150 Minimum = 38ms, Maximum = 40ms, Average = 39ms

If you compare these numbers to the earlier table you'll see that the minimum DNS lookup times closely match to the ping times.

I did plot the first figure but with each result normalised based on the minimum lookup time (i.e. each curve starts from zero milliseconds, and goes up). I didn't feel that graph was any clearer than the one I displayed. But it did show that OpenDNS still performed the majority of queries faster.

2009-12-07 18:34:59

Martijn

I would like to run your benchmark myself, to see if there's a difference between ISP's. Would you be so kind to share the list of domains please?

2009-12-08 10:51:00

John Allen

I'd like to benchmark against my local DNS, could you provide all the files required.

Thanks.

2009-12-08 11:49:01

Robert Chase

Great charts and great idea.

The problem though is your results are heavily biased for your specific network connection. For a user that is a few hops closer or farther away to one of the various DNS servers on your list their results would be different. Perhaps if you were to run your script on several different networks you and had traceroute and latency data you could have a more accurate picture of DNS performance. Routing complicates perfomance testing of this nature.

2009-12-08 22:32:04

bramp

Martijn and John, the files are available!, I quote: "I wrote a little script" and "I found a list of the 1 million most popular sites". With that second link scroll to the bottom of the page and find the compressed zip. To plot the results you can use whatever package you find most useful.

Robert, of course these results depend on my ISP, I wouldn't for a second imply they didn't. If I had a 100 machines around the world I might have ran this test 100 times. Oh, wait a second, I do have access to planetlab, so maybe I will run another experiment. However, the shape of the CDFs can infer information about how the caches are set up irrespectively of the network. For example, OpenDNS is clearly caching more records than anyone else, since 75-95% of the requests happen very quickly. If I was one hop or 100 hops away the those 75-95% would still be served in just over one round trip time. The shape of the distribution is more interesting to me than the actual numbers.

2009-12-09 01:06:57

Warning: The submission system on this blog is flaky at best. Please make a copy of your comment before hitting submit or run the risk of losing it.