Module 4 / When one server isn't enough / DNS: how clients find your servers

Lesson8 minModule 4 · lesson 7 of 9

DNS: how clients find your servers

Turning a name into an address, and why DNS is a powerful but slow-moving lever.

Your customers type deliverit.example, but networks route to IP addresses. The Domain Name System (DNS) translates names into addresses. Your phone asks a resolver (usually run by the network or ISP), which looks the name up through a chain of servers until it reaches the authoritative server you configured, and gets back records such as an A record (name to IPv4 address) or CNAME (name is an alias for another name).

Every answer carries a TTL, the same caching idea as before: resolvers and devices may reuse the answer for that many seconds without asking again. A 300-second TTL means a change you make may take up to about five minutes to reach most users, and some resolvers ignore low TTLs and hold on longer. DNS is therefore a global, heavily cached system: very fast to read, slow to change.

ClientDNS resolverYour DNS recordsLoad balancer IP1. who is thename?2. ask3. address4. connect
A client resolves the name, then connects to the address it receives.

What DNS can do for scaling and availability

Step 1 of 4

Point the name at a load balancer

The common case. One stable name maps to the balancer's address; servers behind it change freely without touching DNS.

deliverit.example.   300   IN  A      203.0.113.10
api.deliverit.example. 300  IN  CNAME  lb-eu.deliverit.example.
lb-eu.deliverit.example. 60 IN  A      203.0.113.20
Illustrative records; addresses are from a reserved documentation range.
Question 1

You change a DNS record that has a 3,600-second TTL. What should you expect?

Question 2

Why point a DNS name at a load balancer rather than listing every server's IP?

Your turn

You are moving your API to a new load balancer with a new IP address. Outline the steps and timing to avoid downtime.

Stuck? Think about the TTL and keeping both balancers alive.

What to remember

  1. DNS maps names to addresses and its answers are cached for their TTL.

  2. Point names at stable load balancer addresses; let balancers handle servers coming and going.

  3. DNS is good for coarse routing (regions, balancers), poor for fast failover.

  4. Lower TTLs ahead of planned changes.