DNS load balancing is the practice of configuring a domain in the Domain Name System (DNS) such that client requests to the domain are distributed across a group of server machines. A domain can correspond to a website, a mail system, a print server, or another service that is made accessible via the Internet.
To review general information about load balancers, see Save 80% Compared to Hardware Load Balancers.
DNS serves as the “phone book” for the Internet: it maps domain names like www.abc.com, which are the equivalent of personal or business names in the phone book, to Internet Protocol (IP) addresses like 172.16.205.3, which are the equivalent of phone numbers. Every device that sends or receives data on the Internet has a unique IP address, which the Internet’s routing software and hardware use to identify and locate the device. DNS is what makes it possible for users to access a website by name, which is easier for most people to remember than the string of numbers in an IP address.
In the simplest deployment, a single computer hosts and serves the data for a domain; when a client requests resolution of the domain name, DNS returns the single server’s IP address. Today many domains use multiple server machines – to protect against server failure or handle high traffic volume, among other reasons – and in this case DNS returns a list of all the servers’ IP addresses in response to a name resolution request.
How DNS Load Balancing Works
DNS load balancing relies on the fact that most clients use the first IP address they receive for a domain. In most Linux distributions, DNS by default sends the list of IP addresses in a different order each time it responds to a new client, using the round‑robin method. As a result, different clients direct their requests to different servers, effectively distributing the load across the server group.
Unfortunately, this simple implementation of DNS load balancing has inherent problems that limit its reliability and efficiency. Most significantly, DNS does not check for server or network outages or errors, and so always returns the same set of IP addresses for a domain even if servers are down or inaccessible.
Another issue arises because resolved addresses are usually cached, by both intermediate DNS servers (called resolvers) and clients, to improve performance and reduce the amount of DNS traffic on the network. Each resolved address is assigned a validity lifetime (called its time-to-live, or TTL), but long lifetimes mean that clients might not learn about changes to the group of servers in a timely fashion, and short lifetimes improve accuracy but lead to the increased processing and DNS traffic that caching is meant to mitigate in the first place.
How Can NGINX Plus Help?
NGINX Plus and NGINX are the best-in-class load‑balancing solutions used by high‑traffic websites such as Dropbox, Netflix, and Zynga. More than 400 million websites worldwide rely on NGINX Plus and NGINX to deliver their content quickly, reliably, and securely.
NGINX Plus provides a range of sophisticated load‑balancing algorithms that are much more effective and accurate than basic DNS load balancing, and with all of them it checks server status to avoid forwarding requests to inaccessible servers. It also supports a form of DNS load balancing that solves the problems described previously; see Configuring HTTP Load Balancing Using DNS in the NGINX Plus Admin Guide. Because it is software‑based, NGINX Plus runs on commodity hardware and is significantly less expensive than most competing hardware‑based solutions.
To learn more about the benefits of using NGINX Plus to load balance your applications, download our ebook, Five Reasons to Choose a Software Load Balancer.