Skip to content
HLD Learn/How the Web Actually Works

DNS: Turning Names into Addresses

4 min read

You'll learn to

  • -Explain why DNS exists and what problem it solves
  • -Describe the steps of a DNS lookup at a high level
  • -Know what a TTL is and why it matters for deployments

A server on the internet is really just an IP address: a string of numbers like 142.250.80.46. Nobody wants to memorize numbers for every site they visit, so the internet has a phonebook that translates human-friendly names into machine-friendly addresses. That phonebook is the Domain Name System, or DNS, and it is the very first thing that happens before any request in this course can be sent anywhere.

ComponentDNS

Think of DNS as the phonebook of the internet. When you type 'google.com' into your browser, your computer has no idea where Google actually lives. It only understands numbers called IP addresses (like 142.250.80.46). DNS is the giant, worldwide phonebook that looks up the name 'google.com' and tells your browser 'Oh, that lives at 142.250.80.46. Go there!' This happens before ANYTHING else on the internet. Every single website visit, every API call, every email. It all starts with a DNS lookup. Without DNS, you'd have to memorize strings of numbers for every website you ever wanted to visit.

Examples: Cloudflare DNS, AWS Route 53, Google Cloud DNS, Namecheap DNS

Why It Matters for System Design

Beyond "name to number," DNS is a design lever. Every DNS record has a TTL (time-to-live): how long other machines are allowed to cache the answer before asking again. A long TTL means faster average lookups but slow propagation when you need to change something (like pointing traffic at a new server during an outage). A short TTL means you can redirect traffic within seconds, at the cost of slightly more DNS traffic. Teams deliberately shorten TTLs before a risky deployment so they can roll back instantly if it goes wrong.

Client
DNS
Web Server

Client resolves the domain via DNS, then connects directly to the server using the returned IP.

ClientDNS- resolve domain -> IPClientWeb Server- connect using IP
  • -DNS can also do geo-routing: sending users in Tokyo to a Tokyo server and users in London to a London one.
  • -DNS is a common first line of defense: providers like Cloudflare filter malicious traffic before it ever reaches your origin.
  • -DNS alone cannot tell if a server is overloaded; that's the load balancer's job, covered in the next module.
DNS in Practice
10-30ms
Typical resolution time
60s-24h
Common TTL range
13
Root server clusters worldwide
~0
Extra latency once cached
Interview Signal

You need to migrate traffic to a new server region with zero downtime. Where does DNS fit in?

Weak Answer

"I'd just update the DNS record to point at the new server."

Strong Answer

"I'd lower the TTL to something small (say 60 seconds) well before the migration, wait for the old TTL to fully expire everywhere, then flip the record. If I forget to lower the TTL first, some fraction of users keep hitting the old server for as long as its previous TTL, however long that was."

ScaleDojo Logo
Initializing ScaleDojo