How DNS Caching, Recursion, and Iteration Really Work
This article explains the DNS caching strategy, the difference between recursive and iterative queries, and how resolvers and authoritative servers cooperate to translate hostnames into IP addresses while optimizing network resources.
Introduction
Domain Name System (DNS) provides a directory service that translates hostnames to IP addresses. A key component is the caching strategy, which determines how physical nodes store data, and the resolution process, which defines query logic and network scheduling rules.
Network Scheduling and Caching Rules
See the diagram below for the detailed flow.
The diagram shows that each server contains two structures: a cache and a resolver. This article first explains the cache; the resolver will be discussed later.
When a request is made, the local resolver checks the browser cache, OS cache, and hosts file. If the TTL has not expired, the cached IP address is used. If the DNS server is not configured, the request follows the router settings, which already involves recursion up to the top‑level domain server.
If an authoritative server returns no result, the domain query will fail on subsequent attempts unless the cache TTL is refreshed, thereby conserving resources.
In an iterative query, a server (A) first checks its cache and may find server B. If B returns null or times out, the query proceeds to server C or D, eventually reaching an authoritative server (often a mirrored service). This process illustrates iteration.
Iterative requests split the domain name and initially use recursion; if no result is found, iteration proceeds, forming a tree‑like resolution where recursion handles parent‑child queries and iteration handles sibling queries.
The green path in the first diagram represents iteration, while the red line shows recursion.
Resolver Search
Iterative resolution maps domain names to IP addresses quickly by building a query tree.
Did you learn this DNS tip today?
Source: https://juejin.cn/post/7304946588752117823
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
