
Every year the speed of the Internet - as the last mile, and the main channels is becoming higher. Only one thing invariably - the latency has already come up against physical limitations: the speed of light in optical fiber is about 200 thousand kilometers per second, and accordingly, in less than ~ 150ms, the response from the server across the Atlantic Ocean cannot be obtained in the foreseeable future (although of course there are delights, like optical fiber with air core or radio-relay communication, but it is hardly available for mere mortals).
When we are trying, for example, from Russia to open a web site located in the USA (its NS server is probably there), and the domain was not found in your provider’s DNS cache — you will have to wait a long time even on the Gigabit Internet, maybe even a full second: while we across the ocean, we will get the names of the NS servers of the domain, while we split their IP, while we send and receive the actual DNS request itself ...
A couple of years ago, Google started its public DNS servers, and to campaign for them, they developed the NameBench
utility , which
runs DNS tests on your surfing history and shows how much Google DNS is faster than your provider's DNS server.
')
But I managed to make my DNS server, which is faster than Google Public DNS, and in this brief note I want to share the results.
PDNSD
pdnsd is a caching DNS proxy. In addition to the banal DNS query caching (with the ability to set the minimum TTL hard - it may be necessary on a very bad Internet), he can send a request to several “parent” DNS servers at the same time, and give the first return answer to the client.
It is the inclusion of a parallel survey and gives us the main advantage in speed , because when finding the result in the cache of any of the providers, we get the result very quickly, and do not expect complete and slow resolution if the first provider does not have a response in the cache.
Put in Ubuntu - the commonplace apt-get.
A couple of moments in the config
global { perm_cache=10240;
In principle, caching can be made less aggressive (min_ttl = 1m for example), but in the course of the year of operation there were no particular problems. In case of problems, if you wish, you can wipe one cache entry:
sudo pdnsd-ctl record 3.14.by delete
or all at once:
sudo pdnsd-ctl empty-cache
Test results in NameBench

We see that for 50% of requests we get a response in less than 10ms, for 85% faster than Google Public DNS, and then the results naturally coincide with Google.
According to the test results, NameBench happily informs us:
8.8.8.8 Slower replica of SYS-192.167.0.98 [192.167.0.98]
8.8.4.4 Slower replica of SYS-192.167.0.98 [192.167.0.98]
Thus, a smart caching DNS proxy with parallel queries allows you to speed up even the 100 Mbit Internet. And for slow (radio) links with high latency and packet loss, the difference can be like between heaven and earth.