DNS Resolution: Path, TTL, Caching & Frontend Impact
DNS is a layered, distributed caching system. A lookup traverses client → OS → recursive resolver → authoritative nameserver. TTL determines how long responses are cached. Understanding resolution path, caching behavior, and TTL trade-offs is essential for frontend performance, migrations, and incident recovery.
Your browser asks the local post office (OS cache). If not known, it asks the regional hub (recursive resolver). The hub walks up the hierarchy (root → TLD → authoritative) and brings back the address. Once delivered, everyone along the route keeps a copy for the TTL duration. Changing an address doesn't instantly update every post office — old copies must expire.
1DNS Resolution Path
Client → OS cache → Recursive resolver → Root → TLD → Authoritative nameserver. Most lookups are served from cache after the first resolution.
Browser → OS → Recursive Resolver → Root → TLD → Authoritative
2Key Record Types
A/AAAA for IP addresses, CNAME for aliases (common with CDNs), TXT for verification. CNAME chains add extra lookups.
3TTL Strategy
Short TTL (30-300s) = fast failover/migrations. Long TTL (1h–24h) = better cache hit rate and lower load. Lower TTL before big changes.
4Caching Layers & Negative Caching
Browser, OS, Recursive Resolver, ISP/CDN layers. Negative caching (NXDOMAIN) can delay new record visibility.
| Property | Short TTL | Long TTL |
|---|---|---|
| Best For | Migrations, failover, blue-green deployments | Stable production domains |
| Query Load | Higher | Lower |
| Propagation | Fast (minutes) | Slow (hours) |
| Cache Efficiency | Lower | High |
Short TTL
Best For
Migrations, failover, blue-green deployments
Query Load
Higher
Propagation
Fast (minutes)
Cache Efficiency
Lower
Long TTL
Best For
Stable production domains
Query Load
Lower
Propagation
Slow (hours)
Cache Efficiency
High
Common questions
- ›“Walk through a DNS lookup.”
- ›“How does TTL affect frontend performance and migrations?”
- ›“What is negative caching and why does it matter?”
- ›“How do you safely migrate traffic using DNS?”
What interviewers look for
- Understanding of layered caching and propagation delays
- TTL trade-offs (agility vs efficiency)
- Connection to real metrics (TTFB, cold start latency)
- Operational awareness (pre-lowering TTL, negative caching)
Short answer (60 sec)
DNS resolution goes through client/OS cache → recursive resolver → authoritative server. TTL controls cache duration. Changes are not instant due to multiple caching layers. Lower TTL before migrations for faster propagation.
Detailed answer (senior level)
DNS is a distributed cache system. A cold lookup traverses multiple layers. Once cached, responses stay until TTL expires. Short TTL enables fast rollbacks but increases load. Negative caching can delay new records. For frontend, DNS affects cold TTFB and CDN effectiveness. Strong answers connect DNS policy to LCP, incident recovery, and multi-region routing.
- Assuming DNS changes are instant
- Using very long TTLs during migrations
- Ignoring negative caching during record creation
- Not lowering TTL before traffic shifts
- Overlooking resolver differences across networks
- ✓DNS is a multi-layer distributed cache, not a real-time lookup
- ✓TTL balances propagation speed vs cache efficiency
- ✓Lower TTL hours before migrations or failovers
- ✓Negative caching can delay visibility of new records
- ✓DNS impacts cold-start TTFB and CDN performance
- ✓Always validate changes with real-user metrics and multiple resolvers