I read a Twitter post earlier mentioning Google’s public DNS service, and suggesting that it could displace the popular OpenDNS
I thought it would be interesting to do a performance comparison between Google and OpenDNS, to see how they compare. I also decided to include the nameservers of my ISP, Virgin Media, to illustrate whether there are performance gains to be had by changing to OpenDNS (which I primarily use, along with others) or Google, or whether staying with defaults works.
Also, I included my local caching resolver (dnsmasq), to illustrate the gains of running a local caching resolver.
I used a selection of popular domains, to allow the resolvers the advantage of most likely having cached results to return.
The full results, ordered by fastest average response, were:
Provider | Average | Best | Worst |
---|---|---|---|
Local | 0.0070 | 0.0037 | 0.1255 |
Virgin | 0.0174 | 0.0101 | 0.1197 |
OpenDNS | 0.0216 | 0.0132 | 0.1100 |
0.0335 | 0.0254 | 0.5210 |
It certainly illustrates that a local caching resolver is a worthwhile speed improvement, although we’re talking fractions of a second – it’s not going to be hugely noticeable. OpenDNS outperformed Google but a small but significant margin too.
I had actually expected Google/OpenDNS to outperform my ISP’s own DNS resolvers, but, speed-wise, they beat both Google and OpenDNS – I guess the ISP’s resolvers have the advantage of being much closer network-wise.
Of course, this doesn’t take into account reliability at all, which is another important point to consider.
If you’re interested, the script I used is included below:
#!/usr/bin/perl
# $Id: dnstiming.pl 789 2009-12-03 19:06:51Z davidp $
use common::sense;
use HTML::Table;
use Time::HiRes;
use Net::DNS::Resolver;
use List::Util;
my @hostnames = qw(
www.google.com
www.facebook.com
www.bbc.co.uk
www.myspace.com
www.yahoo.com
www.wikipedia.org
www.debian.org
www.youtube.com
www.twitter.com
www.imdb.com
www.apple.com
);
my %providers = (
Google => [ '8.8.8.8', '8.8.4.4' ],
OpenDNS => [ '208.67.220.220', '208.67.222.222' ],
Virgin => [ '194.168.4.100', '194.168.8.100' ],
Local => [ '127.0.0.1' ],
);
# Build up a hash of arrayrefs of durations, to average at the end
my %times;
# Now, for each provider, we'll try each hostname against each of their
# resolvers several times, to get more accurate figures.
for (1..50) {
for my $provider (keys %providers) {
for my $server (@{ $providers{$provider} }) {
my $dns = Net::DNS::Resolver->new( nameservers => [ $server ] );
for my $hostname (@hostnames) {
my $start = [ Time::HiRes::gettimeofday ];
my $result = $dns->query($hostname);
push @{ $times{$provider} }, Time::HiRes::tv_interval($start);
}
}
}
}
# Go through each provider and calculate best/worst/avg times:
my @rows;
for my $provider (keys %providers) {
my @times = @{ $times{$provider} };
my $best = sprintf '%.4f', List::Util::min(@times);
my $worst = sprintf '%.4f', List::Util::max(@times);
my $avg = sprintf '%.4f', List::Util::sum(@times) / @times;
push @rows, [ $provider, $avg, $best, $worst ];
}
my $table = HTML::Table->new;
$table->addRow(qw( Provider Average Best Worst ));
$table->setRowHead(1);
for my $row (sort { $a->[1] <=> $b->[1] } @rows) {
$table->addRow(@$row);
}
$table->print;
I looked at OpenDNS a while back and was using it, but I think I may have reinstalled since then and lost the settings. I was attracted by the anti-phishing rather than just speed. It looks like I would get better speed from Virgin, which is what I assume I would be using be default.
Most people have no idea what DNS is, or any other internet protocol, so they are not going to use Google’s.
So, apart from speed, is it worth me setting up either OpenDNS or Google DNS? I could probably set my router to use one of them.
What’s the point of changing to google’s service if it is slow and yet another way for them to gather data. I’d agree with Steve – people will go for the “don’t know, don’t care” attitude.
I was attracted by the anti-phishing rather than just speed. It looks like I would get better speed from Virgin, which is what I assume I would be using be default.
I think open DNS is quit effective and also very fast so I think I prefer openDNS
You could add a link to the free DNS benchmark for windows users too.
at http://www.grc.com/dns/benchmark.htm
Guess I’d be better off changing to OpenDNS although I’m using GoogleDNS right now with no problems. Both of em are better then my local service provider. They’re only turning off their limitations right now.
HSBB Malaysia telekom
I think openDNS is much better and the Google DNS is kind of slow as well.