FullStack AI Hub
Studio
System Design · 01. Foundations
9 min
9 steps
Beginner

Client-Server & DNS

Trace a browser request from recursive DNS lookup and TTL caches to GeoDNS routing and origin TCP handshakes.

System Design01. FoundationsLesson 1 of 3
9 minBeginner9 steps

Client-Server & DNS

Trace a browser request from recursive DNS lookup and TTL caches to GeoDNS routing and origin TCP handshakes.

LOOKUPS/S
1,600/s
LOCAL HIT
82%
RESOLVE P95
14 ms
ORIGIN LOAD
38%
cache missIP → HTTPBrowserOS DNS Cache32%82% local hitDNS Resolver24%UDP :53OriginServer38%203.0.113.42
DNS / HTTP request
cache miss / hierarchy walk
health check / GeoDNS
stale IP / timeout
In This LessonStep 1 of 9
What You Will Master
  • ✓Trace the request-response cycle between browsers, IP addresses, and application origins
  • ✓Follow a recursive DNS lookup across Root, TLD, and Authoritative nameservers
  • ✓Choose A/AAAA/CNAME records and tune DNS TTL to balance lookup speed vs failover agility
  • ✓Eliminate cross-ocean latency and DNS outages using Anycast resolvers and GeoDNS routing

Architectural Trade-Off Comparison Matrix

PatternBest ForKey Trade-Off
A / AAAA RecordMapping apex domains directly to IPv4 / IPv6 addressesRequires DNS update + TTL wait if the target server IP changes
CNAME / ALIASPointing subdomains (api.) to managed CDN or LB hostnamesAdds an extra DNS lookup hop; standard CNAME forbidden at zone apex
Short TTL (30–60s)Fast disaster failover and blue-green migrationsHigher recursive lookup volume and slight extra latency on expiry
Anycast + GeoDNSGlobal apps routing users to their closest healthy regional PoPSome ISP resolvers sit far from users (solved by EDNS Client Subnet)

Step-by-Step Architectural Breakdown (9 Steps)

Full architectural walkthrough transcript and state transitions for Client-Server & DNS.

STEP 01 · SETUPJump to step →

Why browsers cannot dial a domain name directly

When a user types `https://shop.example.com`, network routers have no idea what "shop.example.com" means—internet packets only route to numeric **IP addresses** like `203.0.113.42`.

Before a single HTTP byte can leave the laptop, the operating system checks its local cache and then asks a **DNS Resolver** to translate the human-readable hostname into an IP.

idea:Think of DNS as the internet’s distributed phonebook—every first visit starts with a fast UDP lookup on port 53.

Client-Server ModelIP AddressOS Stub Cache
STEP 02 · TECHNIQUEJump to step →

Recursive Resolver: your ISP’s shared cache

When your laptop misses its local cache, it delegates the entire lookup to a **Recursive Resolver** (like `1.1.1.1`, `8.8.8.8`, or your ISP). Crucially, that resolver serves **millions of users simultaneously**.

If anyone else on your ISP visited `shop.example.com` in the last 5 minutes, the recursive resolver already holds the answer in RAM and replies in **~8 ms** without touching the global DNS hierarchy.

good:Shared recursive caches absorb over 90% of all DNS traffic worldwide—shielding authoritative servers from billions of lookups.

Recursive ResolverShared ISP CacheCache Amplification
STEP 03 · TECHNIQUEJump to step →

Cache miss: walking Root → TLD → Authoritative

On a recursive cache miss, the resolver performs a three-step **iterative tree walk** from right to left across `shop.example.com.`: first asking a **Root Server (`.`)** who owns `.com`.

Next it asks the **`.com` TLD Server** which nameserver owns `example.com`, and finally queries your **Authoritative Nameserver** (Route 53 / Cloudflare) for the exact IP of `shop.example.com`.

idea:Only 13 logical Root Server clusters exist globally (A–M), replicated across 1,500+ Anycast sites so every recursive resolver reaches one in milliseconds.

Root NameserverTLD NameserverAuthoritative Nameserver
STEP 04 · TECHNIQUEJump to step →

DNS Record Types: A, AAAA, CNAME, and ALIAS

An **`A` record** maps a name straight to an IPv4 address (`203.0.113.42`), while **`AAAA`** maps to IPv6. When pointing `shop.example.com` at a cloud load balancer whose IPs rotate, you publish a **`CNAME`** alias instead.

Because RFC rules forbid a `CNAME` at the bare root (`example.com`), modern DNS providers offer **`ALIAS` / CNAME Flattening**, resolving the target dynamically at the authoritative edge in 1 hop.

watch:Avoid long CNAME chains (A → B → C → IP): every extra CNAME hop multiplies cold-lookup latency and failure surface.

A / AAAA RecordsCNAME RecordCNAME Flattening (ALIAS)
STEP 05 · TRADE-OFFJump to step →

DNS TTL: lookup speed vs failover agility

Every DNS answer carries a **TTL (Time-To-Live)** telling resolvers how long to cache it. A **24-hour TTL (86,400s)** gives a **99% cache hit rate** and tiny DNS bills—until your primary datacenter dies.

If you swap the A-record during an outage while a 24-hour TTL is active, millions of users keep hitting the **dead IP for hours**! Production APIs typically choose **60 seconds** so failovers propagate rapidly.

watch:Lower TTL to 60 seconds 24 hours BEFORE a planned migration—shrinking TTL after the old record is already cached won’t take effect until the old TTL expires!

DNS TTLPre-Migration TTL LoweringStale DNS Pinning
STEP 06 · SOLUTIONJump to step →

GeoDNS & Anycast: route users to the closest region

Serving a Tokyo user from a Virginia server wastes **180 ms** just on the speed of light through undersea fiber. **GeoDNS** inspects the requester’s region and returns the nearest healthy regional endpoint (`US-East` vs `AP-Tokyo`).

Meanwhile, **Anycast** announces the exact same IP address from dozens of global PoPs via BGP, so internet routers automatically steer packets to the topologically nearest edge node.

good:Enable EDNS Client Subnet (ECS) so GeoDNS sees the user’s approximate subnet—not just a distant centralized resolver’s location.

GeoDNSAnycast BGPEDNS Client Subnet
STEP 07 · PROBLEMJump to step →

When a single DNS provider goes dark

DNS is the very first link in the chain: if your sole **Authoritative DNS provider** suffers a DDoS or BGP misconfiguration, your perfectly healthy servers become completely unreachable by name.

Even worse, aggressive clients keep retrying failed lookups, turning a short DNS hiccup into a full-blown outage as cached TTLs expire.

watch:Your uptime can never exceed your DNS provider’s uptime—multi-provider secondary DNS eliminates a single-vendor SPOF.

DNS Single Point of FailureNXDOMAIN / SERVFAILSecondary DNS
STEP 08 · SOLUTIONJump to step →

Resilient multi-provider DNS + health-checked failover

Mission-critical domains delegate their NS records across **two independent Anycast DNS providers** (e.g., Route 53 + NS1/Cloudflare). If Provider A goes dark, resolvers automatically retry **Provider B** within milliseconds.

Combined with active origin health checks and a **60-second TTL**, neither a DNS vendor outage nor a regional datacenter failure can take your domain offline.

good:Dual-provider DNS keeps resolution at 99.999% uptime—resolvers natively fail over across all listed NS records.

Multi-Provider DNSNS Record RedundancyActive Health Checks
STEP 09 · RECAPJump to step →

End-to-end client-to-origin blueprint

A production request path caches aggressively at the **OS & Recursive Resolver** layers, keeps **60-second TTLs** for agile failover, uses **Dual-Provider GeoDNS** to pick the nearest healthy region, and lands cleanly on an Anycast Edge Load Balancer.

Trigger a cache flush and regional failover together below to verify the complete request path.

good:Use ALIAS flattening at the apex, 60s TTLs for critical endpoints, and dual Anycast GeoDNS providers so resolution is fast and unbreakable.

Client-Server BlueprintGeoDNS + TTLAnycast Resilience

Related Production Deep-Dives & Simulators

Included In Free Course
Free · Verifiable Credential

FS-102LLM Systems Foundations

Build a connected mental model from tokens through retrieval evaluation security and operations.

24 concepts~18h self-paced
Start Free Course
Weekly Engineering Dispatch

Get the weekly systems teardown

One technical note per week covering inference bottlenecks, retrieval harnesses, and commit-pinned teardowns.