Practice this topic in a realistic system design interview
DNS load balancing uses DNS to distribute traffic across servers and regions.
In this chapter, we will start with round-robin DNS and its limitations, then cover health checks, TTLs, weighted and geographic routing, and how DNS works with traditional load balancers in real systems.
A typical web application has a load balancer in front of several servers. Clients send their requests to the load balancer, which distributes them across those servers.
This works well within a single region. But what happens if that entire region goes down? Or what if a user in Singapore has to send every request to a data center in Virginia?
Now, if your application runs in multiple regions, how do you decide which region each user should connect to?
A load balancer can distribute requests among the servers behind it, but it doesn't automatically decide which region a user should reach. That decision needs to happen before the request reaches the regional load balancer.
This is where DNS comes in. Before a client can connect to api.example.com, it first needs to resolve the domain name to an IP address. By returning different IP addresses based on the user's location, server health, or routing rules, DNS can direct traffic to different regions before a connection is established.
And that's the basic idea behind DNS load balancing.