HAProxy ALOHA can serve as an authoritative Domain Name System (DNS) server in a limited capacity, specifically for implementing global server load balancing (GSLB). This lets you respond to DNS queries with the IP address assigned to a datacenter that is the best match for the end user, such as the one that is geographically closest to them. Or, you can configure DNS to return the address of a secondary datacenter if the primary becomes inaccessible.
By providing GSLB, HAProxy ALOHA can fulfill the following use cases:
DNS round-robin: Distributes traffic between all datacenters in multiple locations.
Failover: Send all traffic to a primary datacenter by returning its IP address(es) in DNS responses, but direct traffic to a secondary datacenter if the primary becomes inaccessible.
Geolocation-based DNS: GSLB enhances functionalities of the DNS naming system by distributing network traffic across servers located in multiple locations. It can detect users' locations and route traffic to the nearest datacenter to lower latency.
HAProxy ALOHA continuously monitors the health of your datacenter IP addresses so that it can remove them from the DNS responses if they become unavailable. It reroutes the traffic to another available datacenter by changing DNS records dynamically.
How global server load balancing works
First, consider how DNS typically works. DNS servers translate human-readable domain names (e.g. www.example.com) to numeric IP addresses (e.g. 10.10.0.5).
A client's web browser queries the DNS server to get the IP address of a website.
The DNS server returns an IP addresses.
The browser connects to the website through its IP address.
Global server load balancing offers a DNS server a smarter way to choose which IP address it should return. It can take into account where the client is located in the world and the health of each datacenter before selecting the IP address to return in a DNS response. This allows it to send a client to the best match.
A client's web browser queries the DNS server to get the IP address of a website, as before.
HAProxy ALOHA, acting as the DNS server, returns an IP addresses, but one based on the geographic IP location of the client and/or the health of the datacenter.
The client gets the best possible user experience by connecting to the website through the IP address of the datacenter that is the best match for them.
HAProxy ALOHA polls the servers to make sure they remain responsive. If they stop responding, then the affected IP addresses will be removed from the list of valid responses HAProxy ALOHA will return to clients.
One caveat: GSLB uses DNS to route clients, and DNS responses are often cached. If a datacenter becomes unavailable, clients will continue to use the cached IP address returned in the original DNS response until the cached response expires. However, it remains an effective strategy overall for distributing traffic across datacenters.
Next upDatacenter failover