Using DNS to balance load across entire continents.
A standard Load Balancer is a physical server that receives traffic and distributes it. But what if the Load Balancer itself goes down? Or what if you have data centers in New York and Tokyo? You can't put a single Load Balancer in the middle of the ocean. Instead, you use DNS Routing. When a user asks "What is the IP of example.com?", the DNS server is smart enough to look at the user's location and reply with the IP address of the closest data center.
Modern DNS providers (like Route53 or Cloudflare) don't just blindly serve static records. They act as dynamic Gateways. They perform Health Checks on your servers every few seconds. If the Tokyo data center catches fire, the DNS server instantly stops handing out the Tokyo IP address, and reroutes all Japanese users to the New York IP instead.
# Example: AWS Route53 Traffic Policy
{
"Record": "api.example.com",
"RoutingPolicy": "Geolocation",
"Rules": [
{
"Location": "Asia",
"Endpoint": "100.50.25.10 (Tokyo Server)",
"HealthCheckId": "hc-12345"
},
{
"Location": "Default",
"Endpoint": "200.10.5.20 (New York Server)",
"HealthCheckId": "hc-67890"
}
]
}
DNS Routing is powerful, but it suffers from DNS Caching (TTL). When the DNS server reroutes traffic away from a dead server, user browsers and ISP routers might cache the old, dead IP address for 5 minutes. During those 5 minutes, those users will see a broken website because they are still trying to connect to the dead server. You cannot force a browser to clear its DNS cache.