You ask the resolver once. It asks three servers.
On a miss it walks the tree. Root refers it to .com, .com to your authoritative servers, and they answer with a TTL.
A cache hit is nearly free. A cold walk isn’t.
Illustratively, with root and .com cached: a resolver 15 ms away plus your servers 150 ms away ≈ 165 ms before TCP starts. So keep hostnames few.
Edit a record. When does traffic move?
Bad: Right away
Caches keep the old answer until its TTL runs out.
Good: Up to a TTL later
Cut the TTL to 60 s one old TTL before a move.
150 s
to fail over with a 60 s TTL
Three failed 30-second checks take up to 90 s. Caches keep the dead address one more TTL. Clients that ignore TTLs take longer.
DNS flipped to Hyderabad; resolvers followed. Your Java service still calls Mumbai.
The catch
The TTL is a request, not a contract. JVMs may cache forever; pools resolve once. Set the JVM’s TTL; cap connection lifetimes.
DNS picks the region. A load balancer picks the server.
Latency or failover records send users to a healthy region, in minutes. Inside it, the load balancer routes around a dead server in seconds.
When DNS is the outage
- Dyn 2016: name servers from two independent providers
- Long TTLs keep cached answers working
- Facebook 2021: never let health checks remove the last capacity
- Keep emergency access off your own DNS
Remember
Every cache keeps DNS answers for the TTL: fast, cheap and stale. So DNS picks the region; a load balancer picks the server, because DNS failover takes minutes, not seconds.