Failures and antipatterns · Intermediate

Resolution failures involving DNS negative caching

Compare authoritative changes with cached negative answers using response codes, TTLs and the resolver actually used by the application.

Ask Logeia about this articleTry the three questionsReview your answers

Updated

On this page
  1. A negative answer can be cached
  2. A newly created name still appears absent
  3. Compare authority with the resolver in use
  4. A TTL edit cannot rewrite an earlier response
  5. Ask Logeia about this articleCheck your understanding

A negative answer can be cached

DNS can cache negative answers as well as successful address lookups. NXDOMAIN indicates a nonexistent name, while a NODATA response concerns the absence of the requested record type. After a new record is added, the authoritative server can answer correctly while a recursive resolver still retains an earlier negative result. The user’s failure is then consistent with the resolver’s current cache rather than proof that the authoritative edit failed. Changing the zone and expiring every cached response are different events in the resolution path.

A newly created name still appears absent

Suppose api.example.test is queried before creation and an NXDOMAIN result is cached for an illustrative negative TTL of 300 seconds. If the record is added after 60 seconds, that cached result can have up to 240 seconds remaining. Real deployments may contain several caching layers and implementation-specific limits. Under RFC 2308, the relevant negative TTL is derived from the minimum of the SOA record’s TTL and its MINIMUM field. The TTL on the newly added A record therefore does not by itself explain the lifetime of the older negative response.

Compare authority with the resolver in use

Compare the response from the resolver actually used by the application with a response from the relevant authoritative server. Record the query name and type, response code, SOA information and remaining TTL. Operating systems and applications can add their own caches, so a successful command-line lookup does not prove that the application uses the same path. Resolution failures such as SERVFAIL may also be cached under separate rules. Do not force every failure into the NXDOMAIN model or assume that changing one authoritative record diagnoses all layers of the lookup process.

A TTL edit cannot rewrite an earlier response

Reducing a negative TTL before a migration can shorten future negative caching, but cannot remotely rewrite the expiry of a response already retained elsewhere. Flushing a resolver you administer is a local intervention, not a mechanism for clearing every user’s cache. Plan when new names are first queried and published, and allow for previously cached negatives. Disabling caching globally sacrifices useful load reduction and resilience. Instead, choose a publication and retry policy that matches the required propagation time, and verify both authoritative correctness and the behavior of the resolver used by real clients.

Reading and practice are recorded separately in this browser, for each language.

Learn this in order

Understand the systems behind the web · STEP 10

Choose a learning path