DNS Resolution & TTL Caching
Walk the Root → TLD → Authoritative lookup chain and choose smart TTLs.
In plain words
When you ask for a website’s address, your local resolver checks its notebook first. If it doesn’t know, it asks the top librarian (Root), then the .com shelf (TLD), then the site’s own directory (Authoritative), and writes the answer down for TTL seconds.
Think of it like…
Asking the front desk where a store moved, then remembering that answer for an hour before asking again.
Theory & how it works
Common DNS record types you’ll actually use
A maps a domain to an IPv4 address (AAAA for IPv6). CNAME aliases one domain name to another (great for pointing www.app.com to your cloud load balancer hostname). NS lists authoritative nameservers.
Remember: you cannot put a CNAME on the bare root domain (example.com), which is why providers like Cloudflare and Route53 offer ALIAS / ANAME flattening.
The TTL trade-off during failover
If your DNS TTL is 24 hours (86,400s) and your primary data center dies, users whose ISPs cached the old IP will keep hitting the dead server for up to 24 hours. Keep critical API TTLs around 30–60 seconds, or lower them 24 hours ahead of a planned move.
Key points & practical guide
Summary checklist
- TTL controls the speed vs. agility trade-off
- Use A/AAAA for IPs and CNAME/ALIAS for cloud load balancers
- Never rely on DNS alone for instant sub-second failover
When to use it
- Multi-region traffic steering
- Zero-downtime blue/green infrastructure migrations
Watch out for
- Setting multi-hour TTLs on failover endpoints
- Trying to put a CNAME on the apex domain