Before we can design any system, we need to understand how a request gets from a user’s browser to our server. It all starts with DNS — the phone book of the internet.
What Happens When We Type a URL?
In simple language, DNS translates human-readable names (like google.com) into IP addresses (like 142.250.80.46) that computers understand. Without DNS, we’d have to memorize IP addresses for every website.
How DNS Resolution Works
DNS has a hierarchy, like asking directions from more and more knowledgeable people:
- DNS Resolver (our ISP or something like 8.8.8.8) — The starting point. It does the legwork.
- Root Name Server — Knows which servers handle
.com,.org,.io, etc. There are only 13 root server clusters worldwide. - TLD Name Server — Handles a specific top-level domain (like all
.comdomains). Points to the authoritative server. - Authoritative Name Server — The final answer. This server actually knows what IP
google.commaps to.
The result gets cached at every level (browser, OS, resolver) with a TTL (Time To Live). That’s why DNS changes take time to propagate — old cached entries have to expire first.
DNS Record Types We Should Know
| Record Type | What It Does | Example |
|---|---|---|
| A | Maps domain to IPv4 address | pman47.cc → 144.24.126.230 |
| AAAA | Maps domain to IPv6 address | pman47.cc → 2001:0db8::1 |
| CNAME | Alias for another domain | www.pman47.cc → pman47.cc |
| NS | Delegates to a name server | pman47.cc → ns1.hostinger.com |
| MX | Mail server for the domain | pman47.cc → mail.pman47.cc |
Why DNS Matters in System Design
DNS isn’t just “it resolves names.” In system design, DNS is a powerful tool:
Load distribution — DNS can return different IPs for the same domain, spreading traffic across multiple servers (DNS round-robin).
Geo-routing — DNS can return the IP of the server closest to the user. A user in India gets routed to the Mumbai server, while a user in the US hits the Virginia server.
Failover — If a server goes down, DNS can stop returning its IP. Health checks detect the failure, and DNS automatically routes traffic to healthy servers.
CDN routing — Services like CloudFront and Cloudflare use DNS to route users to the nearest edge server.
DNS in Our System Designs
When we’re drawing system design diagrams, DNS is usually the very first step:
User → DNS → Load Balancer → Application Servers → Database
We don’t usually deep-dive into DNS in interviews unless asked, but we should always mention it. It shows we understand the full picture — not just the backend.
Quick Gotchas
- DNS propagation delay: Changing DNS records can take up to 48 hours because of caching at various levels. In practice, it’s usually faster.
- DNS is a SPOF (sort of): If our DNS provider goes down, nobody can reach us. That’s why companies like Netflix use multiple DNS providers.
- TTL trade-off: Short TTL = faster failover but more DNS queries. Long TTL = fewer queries but slower to react to changes.
In simple language, DNS is the first thing that happens in any web request. It’s simple in concept but powerful in practice — it can do load balancing, geo-routing, and failover, all before a single HTTP request is made.