Skip to content

We changed the DNS record. Why are 20% of users still on the old IP?

The Connection Is More Than an IP · Part 2 of 6 · 5 min read

Read the worked explanation ↓

Interview question. A public API is moving from an old load balancer to a new one. The team changes the authoritative A record at noon and sets its TTL to 30 seconds. Two hours later, roughly 20 percent of clients are still connecting to the old address. The old balancer is scheduled for shutdown. Should the team simply wait another 30 seconds?

I would stop that shutdown. The immediate safety issue is not whether the DNS provider's control plane accepted the change. It is whether active clients can still reach an address we plan to remove. DNS is a discovery mechanism with multiple caches, not a distributed switch that atomically moves all active connections from one destination to another.

A record's TTL applies to how long a cache can ordinarily reuse the record it obtained. It does not reach backward and shorten an answer already cached elsewhere. Suppose a resolver fetched the old A record at 11:59 with a TTL of 3,600 seconds. Lowering the record at noon does not rewrite that resolver's existing remaining lifetime. If you want a lower TTL to help the cutover, publish it long enough before the address change for older caches to age out under normal behavior.

A migration timeline shows the old TTL already cached before it was lowered and both old and new endpoints staying live during the cutover.
A migration timeline shows the old TTL already cached before it was lowered and both old and new endpoints staying live during the cutover.
Think first

You must move the public API from region A to region B without changing the hostname. Historical TTL is one hour, and customers use mobile SDKs with long-lived connections. Design a cutover timeline, observability, rollback, and a rule for retiring region A.

Take a few minutes to form an approach, then compare it with the worked explanation.

Reveal the worked explanation

DNS TTL is not a connection drain

Even after a client obtains the new IP, an established HTTP connection to the old IP can remain active. HTTP connection pooling, long-lived streams and application-specific DNS caches can retain earlier destination choices. A JVM, a browser, a sidecar proxy and a corporate resolver may have different cache policies. Some resolvers clamp unusually short TTLs, and some clients do not respect TTL behavior exactly. We should investigate those cases, not design for an impossible global cache flush.

There is another subtlety. During trouble reaching authoritative nameservers, a recursive resolver implementing serve-stale behavior may deliberately return expired records for resilience. RFC 8767 standardizes this pattern under specific conditions. That is a good availability feature in many incidents, but it weakens the idea that TTL expiry itself is a strict operational deadline for retiring an address.

The observed 20 percent could also reflect something other than DNS. Maybe one address family was updated and the other wasn't. Maybe a CNAME chain retains an old provider target. Maybe a portion of traffic is pinned to old connections, or one resolver's cache is behaving differently. I would log the destination IP that actually receives each request, compare it with sampled resolver answers, and determine whether the clients are making new connections to that IP or continuing existing ones. Those are different fixes.

Plan the migration around overlap, not a stopwatch

I would keep the old load balancer functional while gradually introducing the new one. Both destinations should serve compatible application versions, correct certificates, routing rules and access policies. If the service writes to durable state, old and new entry points must reach the same authoritative backend or an explicitly designed migration path. Running two API front doors must not accidentally split state or create duplicate ownership.

Days or hours before the change, depending on the previous TTL and observed client behavior, lower the TTL. Verify the low TTL from multiple independent recursive resolvers, not only by querying the authoritative provider. Then bring the new endpoint online and probe it directly before changing public answers. An initial canary using a small traffic segment or distinct test hostname is safer than relying on DNS records as fine-grained load balancing.

At cutover, change the relevant record sets and monitor new versus old destination traffic, error rates, request latency and connection age. Drain old instances at the application or load-balancer layer where possible, but continue accepting traffic to the old address during the compatibility window. If the old entry point can safely proxy or redirect requests to the new system, that may help, provided hostnames, certificate validation, authentication and non-idempotent requests remain correct. A bare HTTP redirect cannot repair clients that fail before making an HTTP request.

The rollback path matters. If the new balancer has a route defect, we can restore the old DNS answer, but many clients will still have the new address cached. Therefore rollback also requires keeping the new endpoint capable of serving or forwarding until those clients can recover. DNS rollback is another gradual transition, not an atomic undo button.

What if old servers are already gone?

Now the problem is containment. Restore the old address or a compatible listener as quickly as the infrastructure permits, while keeping the new address healthy. If the previous public IP cannot be reclaimed, determine whether the old provider can keep forwarding requests. Communicate to affected customers, collect destination-IP diagnostics and avoid a sequence of frantic DNS changes that generates additional cache populations.

A useful release gate is based on observed traffic, not an arbitrary multiple of a low TTL. I would require sustained low or zero traffic to the old destination across a suitably long observation period, consideration of long-lived clients, and explicit exceptions for embedded or managed clients with unusual caching. Some clients may be permanently misconfigured, so perfect zero may be unachievable. The team must make that residual risk visible.

For Staff-level interviews, the key architectural insight is that the old endpoint is part of the migration plan. A DNS record can steer future discoveries, but a reliable cutover requires overlap, compatibility, observability and rollback on both sides. That mindset becomes equally important when the next stage, HTTPS identity, has to remain valid across both destinations.

Go deeper

A record TTL usually travels with the record set from the answering resolver and decreases while cached. A resolver's remaining TTL may be much shorter than the original authoritative TTL, while another resolver still has most of the original interval left. Stale serving under RFC 8767 is conditional and configurable, not a guarantee that all resolvers do it. Direct dig @authoritative confirms intended zone publication, not the state of the global recursive cache population. DNS-based steering is suitable for coarse traffic movement but does not provide strong connection stickiness or deterministic withdrawal timing.

Check your reasoning

  • Distinguish old cached TTL from the new authoritative value.
  • Separate DNS resolution from existing HTTP connection lifetime.
  • Plan overlap and compatibility at both old and new destinations.
  • Use destination-IP observations and several recursive resolvers.
  • Design a rollback that serves clients with either address cached.

Common mistake: Lowering authoritative TTL to 30 seconds makes all caches drop the prior value within 30 seconds.

DNS now advertises a new API address with a 30-second TTL, but clients still reach the old endpoint. Which migration policy is safe?

Read the answer explanation

Keep both endpoints compatible, measure old traffic, and drain on evidence — Past answers and persistent connections are not atomically invalidated by a new TTL.

Apply it elsewhere

A SaaS provider changes the CNAME used by customers to reach its custom domain service. One corporate customer's resolver returns the previous provider for an extended period. What compatibility protections can remain at the old edge while the customer fixes its network?

Compare your approach

Discuss already-cached records, pooled connections, old/new compatibility, authoritative versus recursive measurements, phased drain and real rollback limitations.

One more constraint

A resolver cached a 3,600-second record one minute before a TTL reduction. Is the resolver required to discard the record 30 seconds after the authoritative TTL becomes 30 seconds?

Quick revision

Lowering an authoritative TTL does not retroactively invalidate old cached answers or existing HTTP connections. A safe DNS migration lowers TTL in advance, validates the new endpoint, keeps both destinations serving, measures traffic by actual destination IP, and drains the old one only after a deliberate compatibility window. Rollback must preserve both entry points because clients can have either answer cached. A 30-second TTL is not a 30-second global cutover deadline.

References