开发者

What algorithms do DNS servers use for faster lookups?

开发者 https://www.devze.com 2022-12-09 00:26 出处:网络
DNS servers have to be fast in order to avoid latency. What algorith开发者_StackOverflowms do DNS Servers use to reduce latency? Are they any caching mechanisms that could be effectively used to impro

DNS servers have to be fast in order to avoid latency. What algorith开发者_StackOverflowms do DNS Servers use to reduce latency? Are they any caching mechanisms that could be effectively used to improve speed?


Latency is a huge problem with DNS. The slowest part of DNS is reaching out across the 'Net and querying other servers. Any caching a client or server does will speed up the process. In fact, that's exactly what happens.

When a DNS server responds to a query, the answer comes back with a TTL (time-to-live). The TTL value tells the querying server how long to cache the response. The TTL value is set by the authoritative server for the zone. Typically it's about a day, but can vary depending on how often the administrator thinks the DNS entry might change.

The DNS client (which might be another server acting on behalf of an end user) caches the response and will flush it out of its cache when the TTL has been exceeded. Until that time, subsequent queries for that particular hostname will come out of the cache.

I used to run my own DNS server at home so all my computers on my LAN could take advantage of the local cache. But I discovered that it was better to use my ISP's DNS servers. They benefitted from the queries of thousands of customers and were much more likely to have more cached answers than my servers ever could.


I know this question already has an accepted answer, but there's much more you can do than just caching. For example:

  1. Use BGP to establish a network of geographically distributed servers, reachable via Anycast. This can reduce the average number of hops that a DNS query packet has to traverse.

  2. Eliminate latency-containing infrastructure. For example, host your DNS servers with your ISP or at a large Internet peering point instead of at the slow end of a WAN.

  3. Avoid CNAME records; prefer A records instead. CNAMEs often require multiple queries to resolve.

  4. Use a robust, high-performance commercial service, such as UltraDNS.

0

精彩评论

暂无评论...
验证码 换一张
取 消