DNS

DNS is the internet's phone book — it turns the names humans use into the addresses machines route to — and it's also the internet's most common outage cause and a frequent source of baffling latency. "It's always DNS" is a running joke among engineers precisely because DNS is invisible until it breaks, and then it breaks everything.

Before any TCP handshake or HTTP request, one thing has to happen: your machine needs the IP address of the server it’s trying to reach, and all it has is a name like example.com. DNS (the Domain Name System) is the distributed system that resolves names to addresses. This post covers how resolution works, the record types you’ll actually configure, the caching that makes it fast (and occasionally maddening), and why DNS is such a frequent culprit in outages and latency.

The problem DNS solves

Humans use names (example.com); the network routes on IP addresses (203.0.113.10, from the IP post). DNS is the translation layer between them — a globally distributed database mapping names to addresses (and other records). Its job sounds simple but is remarkable in scale: it must answer billions of lookups a second, stay available globally, and let anyone update their own names — with no central server holding everything. It achieves this by being a distributed, hierarchical, heavily-cached system, and each of those properties explains part of its behavior.

How resolution works

Resolving a name walks a hierarchy of servers, from the most general to the most specific:

Your app wants example.com →
  1. Resolver (your ISP's or a public one like 1.1.1.1) — does the legwork, caches results
  2. Root servers        → "ask the .com servers"
  3. TLD servers (.com)  → "ask example.com's authoritative servers"
  4. Authoritative servers for example.com → "example.com is 203.0.113.10"
  → resolver returns the address to your app (and caches it)

This walk happens (mostly) over UDP (from the TCP/UDP post) — small request, small response, where TCP’s handshake overhead would be wasteful — which is one reason DNS is fast when it’s cached and why it’s a classic UDP use case.

The record types you’ll use

DNS holds several record types; a handful matter for everyday backend work:

Configuring these correctly is the substance of “DNS setup” for most engineers: an A/AAAA (or CNAME) to point your domain at your server/CDN, MX for mail, TXT for verification. Getting a record wrong — or waiting for it to propagate — is a routine source of “the site works for me but not for them.”

Caching and TTL: fast, but with a lag

DNS is fast because results are cached at every level — the resolver, the operating system, and the browser all cache answers so most lookups never traverse the full hierarchy. Each record has a TTL (time-to-live) telling caches how long to keep it before re-querying:

This caching is a double-edged sword and the source of DNS’s most infamous behavior — propagation delay. When you change a DNS record, caches around the world keep serving the old value until their TTL expires, so the change appears to “propagate” gradually over minutes to (with high TTLs) up to a day or more. This is why:

Understanding TTL and propagation is what turns DNS changes from mysterious and scary into predictable and planned.

Why “it’s always DNS”

DNS has an outsized reputation for causing problems, and the reasons are structural — worth knowing so you check DNS early when debugging:

The practical wisdom encoded in “it’s always DNS”: when something is mysteriously broken, unreachable, or slow-to-first-byte — check DNS first. Verify the name resolves, resolves to the right address, and isn’t mid-propagation. A large share of “the network is broken” incidents are really DNS, and it’s the cheapest thing to rule out. DNS resolved, the connection can proceed — next, securing it with TLS.

Key takeaways

Further reading

Sources & References

DNS resolution