Interview's MateSystem Design
Interview's Mate

System Design

Architecture & trade-offs

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
All topics/DNS & Anycast Routing
FUNDAMENTALS & NETWORKING · SUBTOPIC

DNS Resolution & TTL Caching

Walk the Root → TLD → Authoritative lookup chain and choose smart TTLs.

BeginnerPart of DNS & Anycast Routing
Practice in AI HLD
Subtopics in DNS & Anycast Routing (2)
OverviewResolution & TTLGeoDNS & Anycast

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.

Loading interactive diagram
Loading interactive exercise

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

Quick check

Loading quiz
Parent topic
DNS & Anycast Routing
Next subtopic
GeoDNS & Anycast BGP Routing