Your DNS TTL Is a Suggestion, Not a Switch
TTL is a hint, not a contract
Almost every failover runbook contains the same hopeful line: drop the TTL to sixty seconds before the change window, and clients will pick up the new address within a minute. It is a tidy plan. It is also closer to a wish than a specification. A TTL tells a resolver how long it may keep an answer cached. It says nothing about how long anyone must. The moment your record leaves your nameserver, control passes to a chain of software you do not own, cannot inspect, and have almost certainly never tested.
The caches you forgot about
When people say DNS, they usually mean the recursive resolver their ISP or corporate network runs. That resolver probably respects your TTL reasonably well. The trouble is everything sitting between it and your application.
- Operating system stub resolvers, which keep their own caches and occasionally apply their own minimum.
- Language runtimes and application servers. The JVM, for instance, has its own DNS cache governed by security properties that teams tweak once and then forget about for years.
- Connection pools and keep-alive, which are the big one, as we will see.
- Browsers, which cache resolutions per profile, per tab process, and per private session.
- Corporate proxies, VPN clients, and home routers that forward and cache under their own rules.
- Some networks deliberately impose a minimum TTL floor, so your optimistic ten seconds quietly becomes five minutes.
The connection that outlives the record
Here is the part that ruins most failover plans. A DNS lookup happens once, at the start of a connection. After that, the client talks to an IP address, not a hostname. If your application holds an HTTP/2 connection open for hours, that connection will keep pointing at the old server long after every cache on the internet has forgotten it. The client is not ignoring your DNS change; it is simply not asking the question any more. It is also worth checking personalized letterman jacket before you decide.
Modern protocols make this worse. Connection reuse, HTTP/2 multiplexing, QUIC connection migration, and speculative preconnection all exist to avoid the latency of a fresh lookup. They are excellent for users and faintly hostile to anyone hoping to shift traffic with a TTL change.
Negative caching bites back
Removing a record is a popular failover move, and it is a trap. Negative answers get cached too, under rules set out in RFC 2308, with the duration often derived from your zone's SOA minimum. Pull an A record during an incident and you may have published an outage longer than the one you were responding to. Some resolvers are also generous about caching SERVFAIL, which means a brief wobble on your authoritative side can be remembered by strangers for far longer than it lasted.
Delegation has its own clock
If failover involves changing nameservers rather than addresses, forget your TTL entirely. Parent zone delegations and registry operations carry their own lifetimes, frequently measured in hours or days, and registries do not hurry because you are having a bad afternoon.
What actually works
DNS is a fine tool for gradually moving traffic. It is a poor tool for rapid failover. Treat a short TTL as a coarse lever that buys you minutes rather than seconds, and build the rest of the stack accordingly.
- Put a health-checked load balancer, proxy, or anycast layer in front, and move traffic there rather than in the resolver.
- Design clients to retry against a second address, and verify that they really do instead of collapsing at the first refusal.
- Keep connections short where you can, and make clients reconnect on error rather than on a schedule.
- Rehearse your failover, and measure how long real clients take to move rather than how long your nameserver takes to answer.
None of this means TTLs are useless. A short TTL still reduces the blast radius of a bad address, and a sensible default of a few minutes is far kinder to your future self than the twelve hours many zones still carry. Just do not build a guarantee on top of it. The honest framing for stakeholders is that DNS gives you eventual consistency measured in minutes to hours, and that anything faster needs a mechanism which operates on live connections rather than on lookups.
Test from the outside
Query your records from a public resolver, a corporate network, a mobile connection, and the machine running the application. Compare the answers and their ages. If they diverge, you have found the reason your plan is being ignored, and it is probably not the resolver you were blaming.













User Experience
Karla Gleichauf
12 May 2017 at 05:28 pm
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment
M Shyamalan
12 May 2017 at 05:28 pm
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment
Liz Montano
12 May 2017 at 05:28 pm
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment