Back
Web Fundamentals

DNS Resolution: Path, TTL, Caching & Frontend Impact

On this page

mediumRendering & Browser Architecture

DNS Resolution: Path, TTL, Caching & Frontend Impact

TL;DRDNS = distributed cache hierarchy. TTL controls agility vs cache hit rate. Changes propagate gradually.
High Signal
Google
Meta
Netflix
Agoda
30-Second Answerstart every interview with this

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.

Browser / OS Cache
Recursive Resolver
Root → TLD → Authoritative
Response + TTL Caching at Every Layer

1DNS Resolution Path

Client → OS cache → Recursive resolver → Root → TLD → Authoritative nameserver. Most lookups are served from cache after the first resolution.

resolution-flowtext
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.

PropertyShort TTLLong TTL
Best ForMigrations, failover, blue-green deploymentsStable production domains
Query LoadHigherLower
PropagationFast (minutes)Slow (hours)
Cache EfficiencyLowerHigh

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
Key Takeaways
  • ✓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

Related web fundamentals topics

Continue with closely related browser and frontend engineering concepts.

HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC) for Frontend PerformanceFramework Reactivity: React, Vue, Svelte & SolidReact Server Components: Zero-JS Server RenderingIslands Architecture: Independent Component HydrationStreaming SSR: Progressive HTML StreamingRendering Strategies: CSR vs SSR vs SSG vs ISR
Previous TopicHTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC) for Frontend PerformanceNext Topic Cross-Site Scripting (XSS) Attacks