TRT
Sign in
NetworkInternalsnetwork

Trace: DNS Resolution Is a Chain of Cached Questions

DNS maps names to typed records through a distributed hierarchy. A stub resolver usually asks a recursive resolver to find an answer. That resolver may consult caches, follow referrals from root to top-level and authoritative servers, and return records with a time-to-live.

The Runtime Theory Team8 min read05 steps

layer stack

Network

HWHardware
KKernel
RTRuntime
APPApplication
SYSSystem
CLIClient
NETNetwork
TLSCrypto
SRVServer

adjacent altitudes in this subsystem are still being traced

trace spine

  1. 01 Ask the configured resolver
  2. 02 Check resolver cache
  3. 03 Follow a referral if needed
  4. 04 Return the authoritative record
  5. 05 Cache the answer until expiry

This trace follows the actual state transitions behind the companion DNS Resolution Is a Chain of Cached Questions. Each step below names its concrete inputs; values illustrate the mechanism and vary across implementations.

Step 1: Ask the configured resolver

DNS maps names to typed records through a distributed hierarchy. A stub resolver usually asks a recursive resolver to find an answer. That resolver may consult caches, follow referrals from root to top-level and authoritative servers, and return records with a time-to-live.

Step 2: Check resolver cache

For a hostname, the answer can involve a CNAME alias followed by address records. The recursive resolver caches each record within its TTL, so two clients can observe different answers during a change. Negative answers can also be cached, affecting how quickly a newly created name becomes visible.

Step 3: Follow a referral if needed

A recursive resolver can answer from cached data or follow referrals through the DNS hierarchy; the returned TTL controls cache lifetime and clients can see old data until it expires.

Checkpoint: A recursive resolver can answer from cached data or follow referrals through the DNS hierarchy; the returned TTL controls cache lifetime and clients can see old data until it expires. Confirm this state before advancing to Return the authoritative record.

Step 4: Return the authoritative record

DNS is not a single global database lookup and a resolver’s cache may be stale until expiration. Multiple A or AAAA records do not guarantee that every client uses them as intended. DNSSEC can authenticate signed DNS data, but it does not encrypt ordinary DNS queries or secure the application protocol.

Step 5: Cache the answer until expiry

A service moves to a new address but some users keep reaching the old one. Trace which caches may be involved and explain why lowering TTL immediately before a change may not help clients that cached an earlier TTL.

The trace is done when this check holds: A service moves to a new address but some users keep reaching the old one. Compare the outcome against the companion article before making a performance claim.

Hardware, runtime, and observability notes

When tracing Trace: DNS Resolution Is a Chain of Cached Questions in a live production environment (subsystem: network, primary layer: network), keep the following step-level cost model and diagnostic checklist in mind:

  • Step 1 (network): Ask the configured resolver — verifies state invariants before advancing the execution pointer.
  • Step 2 (network): Check resolver cache — verifies state invariants before advancing the execution pointer.
  • Step 3 (network): Follow a referral if needed — verifies state invariants before advancing the execution pointer.
  • Step 4 (network): Return the authoritative record — verifies state invariants before advancing the execution pointer.
  • Step 5 (network): Cache the answer until expiry — verifies state invariants before advancing the execution pointer.

Every transition across the network boundary carries both a direct CPU/memory cost (cache-line fills, descriptor lookups, lock acquisitions, or context switches) and a tail-latency queueing risk under contention. To verify this trace on your own service, capture latency histograms and hardware/kernel counters across each step boundary, compare cold-cache versus warm-cache execution paths, and confirm that error or timeout branches release all acquired descriptors, locks, and buffers cleanly.

Not started

Sign in to save your learning progress.

Sign in to save