Share traffic by giving different IP addresses to different users.
DNS load balancing shares traffic by giving different IP addresses for the same domain name. Each user gets a different answer, so users spread across servers.
DNS turns a name like shop.example.com into an IP address. In DNS load balancing, the same name has many IP addresses. The DNS server picks which to return, or returns them in a rotating order.
There is a catch. People write the number on a sticky note and keep calling it. If a branch closes, those people keep calling the closed branch until they throw away the note. That sticky note is the DNS cache, and its life time is the TTL.
The DNS zone has many A records for one name. Each answer lists them in a different order.
shop.example.com. 60 IN A 203.0.113.10 shop.example.com. 60 IN A 203.0.113.11 shop.example.com. 60 IN A 203.0.113.12 ; ^ TTL in seconds
Managed DNS services (like AWS Route 53 or Cloudflare) let you give each record a weight. A record with weight 70 is returned 70% of the time.
The DNS server looks at where the question came from and returns the nearest or fastest server.
Managed DNS can check each server. If one fails, it stops returning that IP. This is better, but the TTL still delays the effect.
$ dig +short shop.example.com 203.0.113.11 203.0.113.12 203.0.113.10 # run again: the order rotates
| Term | Meaning in easy words |
|---|---|
| DNS | The system that turns a domain name into an IP address |
| A / AAAA record | A DNS entry that maps a name to an IPv4 / IPv6 address |
| TTL (time to live) | How many seconds an answer may be cached |
| Resolver | The DNS server of your ISP, company or Google (8.8.8.8) that asks on your behalf |
| Authoritative server | The DNS server that owns the real records for a domain |
| Round-robin DNS | Rotating the order of the IPs on each answer |
| Geo DNS | Different answers by the user location |
| Health-checked DNS | DNS that stops returning IPs of failed servers |
| DNS failover | Changing the answers to point to a backup site |
| Propagation | The time it takes for a DNS change to reach every cache |
| Choice | We gain | We lose |
|---|---|---|
| Short TTL | Fast failover | More DNS queries, a bit slower first load |
| Long TTL | Fewer lookups, steady | Slow to react to failure |
| Round robin only | Very simple | No health awareness |
| Managed DNS + health checks | Auto removal of dead IPs | Cost, still bound by TTL |