Back
Web Fundamentals

DNS Resolution: Path, TTL, Caching & Frontend Impact

Web Fundamentals
Build & Deployment: Monorepo, CI/CD, Strategies & Release SafetyState Management: Choosing the Right SolutionRedux: Predictable State Container (RTK + RTK Query)React Query (TanStack Query): Server State CachingData Fetching Patterns: REST, GraphQL, tRPC & Real-timeGraphQL Fundamentals for Frontend: Shape, Caching, and TradeoffsgRPC-Web Fundamentals: Browser Constraints and Proxy ModelCaching Strategies: Client, Server & EdgeData Normalization: Organizing State for PerformanceAPI Design Best Practices: Pagination, Errors, Versioning & Type SafetyAPI Versioning Strategies for Frontend CompatibilityPagination: Offset vs Cursor-BasedRate Limiting & API Resilience: Retries, Backoff, Jitter, IdempotencyHow Frontend Developers Can Handle Millions of API Requests Without Crashing EverythingBrowser Storage: Cookies, SessionStorage, LocalStorage, IndexedDBReal-time Communication: WebSockets, SSE & PollingWebRTC: Real-Time Communication in the BrowserCore Web Vitals: LCP, INP & CLSPerformance Optimization Trade-offsCritical Resource Prioritization: Optimize Loading OrderCode Splitting: Optimize Bundle Size with Dynamic ImportsTree Shaking: Eliminate Dead Code from Your BundleLazy Loading: Load Resources On-DemandResource Hints: Preload, Prefetch & PreconnectText Compression: Gzip and BrotliImage & Video Optimization: Modern Formats & TechniquesAdaptive Loading: Optimize for Device & NetworkList Virtualization: Render Large Lists EfficientlyWeb Workers vs Main Thread: Offloading Heavy WorkMemory Leaks in Frontend Apps: Detection & PreventionManaging Third-Party Scripts: Optimization StrategiesHow CDNs Work: Edge Delivery, Caching & PerformanceHTTP Caching Deep Dive: Cache-Control, ETag & RevalidationService Workers & Offline Strategy: Cache First, Network First & Update LifecyclePWA Fundamentals: Manifest, Installability & Offline UXCritical Rendering PathScript Loading: async vs deferEvent Loop: Understanding JavaScript Execution ModelJavaScript Module Systems: CJS vs ESM vs UMDDynamic Module Loading: import() FunctionImport on Interaction: Load When User InteractsImport on Visibility: Lazy Loading with IntersectionObserverBrowser Rendering Pipeline & Layout ThrashingRendering Strategies: CSR vs SSR vs SSG vs ISRStreaming SSR: Progressive HTML StreamingIslands Architecture: Independent Component HydrationReact Server Components: Zero-JS Server RenderingFramework Reactivity: React, Vue, Svelte & SolidHTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC) for Frontend PerformanceDNS Resolution: Path, TTL, Caching & Frontend ImpactCross-Site Scripting (XSS) AttacksCross-Site Request Forgery (CSRF) AttacksCORS Explained: Cross-Origin Resource SharingCORS Preflight in Practice: Credentials, Simple Requests & MisconfigurationsContent Security Policy (CSP)Why is HTTPS Secure? Understanding TLS/SSLAuthorization Best PracticesCookie Security & Session Hardening: SameSite, HttpOnly, Secure
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
Previous TopicHTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC) for Frontend PerformanceNext Topic Cross-Site Scripting (XSS) Attacks

On this page