DEV Community

DNS TTL Propagation Math: Why Negative Caching Stalls Cutovers

"DNS propagation takes 24 to 48 hours" gets repeated on almost every migration checklist, even when the domain's TTL is 300 seconds.

In reality, recursive resolvers do not share a global propagation timer - they simply hold whatever answer they cached until its TTL counts down to zero. If you know the previous TTL, how recently resolvers could have cached it, your authoritative sync delay, and the zone's negative cache TTL, you can bound the cutover window with simple arithmetic.

The actual TTL expiry math

Suppose api.example.com currently has an A record with a 3,600-second (60-minute) TTL, and your authoritative DNS provider takes 60 seconds to push zone changes across all its edge nodes. When you switch the IP address:

Remaining old-cache = max(Old TTL − Cache age, 0)

For a resolver that fetched the old record 900 seconds (15 minutes) ago:

  • Worst-case wait for that resolver: 3,600 − 900 = 2,700 s (45 minutes) plus 60 s authoritative delay = 46 minutes.
  • Typical planning midpoint across a population of resolvers at random cache ages: roughly half the remaining TTL plus authoritative delay (2,700 / 2 + 60 = 1,410 s, or 23.5 minutes).

Because you cannot observe every recursive resolver on the internet, cutover rollback plans should target the conservative worst case (the full remaining old TTL plus authoritative sync delay), not the midpoint.

Why lowering the TTL 30 minutes before cutover fails

A common deployment mistake is dropping a record's TTL from 86,400 s (24 hours) to 60 s right before the maintenance window. Any resolver that looked up the old record five minutes before your TTL change already stored 86,400 seconds alongside that answer. It will not check back to discover that you lowered the TTL to 60 seconds.

That resolver continues serving the old IP for up to 23 hours and 55 minutes after your TTL edit.

To shrink the cutover window to 60 seconds, you have to lower the TTL at least one full old-TTL period in advance - 24 hours early if the record started at 86,400 s, or 1 hour early if it started at 3,600 s. Only after the old cache expires can you assume resolvers hold the shorter 60 s timer.

The negative caching trap (NXDOMAIN and NODATA)

Cutovers still go wrong when teams create a brand-new hostname or move a subdomain by deleting and recreating records. Under RFC 2308, recursive resolvers cache the absence of a record (NXDOMAIN for a missing name, or NODATA when the name exists without the queried record type). The lifetime of that cached failure comes from the zone's SOA MINIMUM field (the negative cache TTL), not the TTL you put on the new A or CNAME record.

Assume your zone's SOA negative TTL is 1,800 seconds (30 minutes), and your new record uses a 60-second TTL:

  • You announce or test new-api.example.com five minutes before the record finishes propagating.
  • A resolver queries it, receives NXDOMAIN, and caches that failure for 1,800 seconds.
  • Even though the A record goes live 60 seconds later with a 60-second TTL, affected clients keep failing for up to 1,800 + 60 = 1,860 s (31 minutes).

Always account for the larger of the two timers:

Conservative window = max(Old TTL − Cache age, Negative TTL, 0) + Authoritative update delay

For zero-downtime launches, create the new record before any monitoring script, health check, or client touches the hostname, and keep the old endpoint online until the conservative window passes.

Check the query-rate jump before keeping a short TTL

Shortening TTLs permanently reduces cutover friction, but it multiplies authoritative query volume:

  • At 3,600 s: 86,400 / 3,600 = 24 refreshes per day per active resolver
  • At 60 s: 86,400 / 60 = 1,440 refreshes per day per active resolver (60× higher query rate)

If your authoritative DNS plan bills per million queries or runs on self-hosted name servers, restore the longer TTL once the migration settles and traffic on the old target drops to zero.

I maintain NetEngineerLab, where the DNS TTL & Propagation Time Calculator computes the old-cache remainder, conservative window (including negative cache TTL), advance TTL-lowering lead time, and daily query-rate multiplier in one view.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.