CONCEPT SHEET · Concepts

DNS

One-liner: Hierarchical, cached, eventually consistent directory mapping names to records; also the coarsest layer of load balancing and failover.

ArticleConcepts© Arthur Bernier Jr531 words1 code block

Say this#

How it works#

TEXT
browser cache -> OS cache -> recursive resolver (cached?)    -> root (.)  -> "ask .com"   -> .com TLD  -> "ask ns1.example.com"   -> authoritative -> A 203.0.113.10, TTL 60
  1. Client asks recursive resolver; cache hit returns immediately.
  2. Miss: resolver walks root → TLD → authoritative (roots/TLDs are heavily cached so usually one hop).
  3. Authoritative may answer based on resolver location (GeoDNS) or health (failover).
  4. Result cached for TTL at every layer; some resolvers/OSes clamp or ignore TTLs.

As a load balancer: return multiple A records (round-robin), weighted answers, or geo-nearest. Coarse because of caching: stale IPs survive for TTL after failover, and clients pick records unevenly.

Trade-offs#

ChoiceProCon
Low TTL (30-60 s)Fast failover and migrationsMore resolver queries, higher authoritative load/cost
High TTL (hours)Fewer lookups, resilient to DNS outagesSlow to change
DNS round-robin LBFree, globalNo health awareness at client; caching skews distribution
GeoDNSRoute users to nearest regionResolver location ≠ user location (ECS helps)
AnycastFastest, DDoS-absorbingNeeds BGP control; TCP sessions can break on route changes
CNAME vs ALIAS at apexCNAME simpleCNAME not allowed at zone apex; use ALIAS/ANAME

Numbers#

  • Uncached full resolution: ~20-120 ms; cached: <1 ms.
  • Typical TTLs: 60-300 s for app endpoints, 3600+ s for stable records.
  • 13 root server identities (A–M), each anycast across hundreds of sites.
  • UDP DNS message limit 512 bytes classic, ~1232-4096 with EDNS0; falls back to TCP when larger.

In the interview#

See also