The round-robin Domain Name System (DNS) is a system of load balancing or distributing tasks over a given number of resources. The effects of load balancing can also be known as "load distribution". Round-robin DNS is a common way of ensuring the load of DNS requests is evenly distributed. It is the most commonly used algorithm for load balancing.
With round-robin DNS, load balancing occurs in the DNS server rather than a dedicated load balancing system. The term "round-robin" refers to the DNS server’s circular route in selecting consecutive IP addresses.
More than just a cute name, round-robin DNS affects your whole web service. Now let’s take a look at what makes it so important.
The importance of Round-Robin DNS
The most important function of round-robin DNS is to enable load balancing that makes it possible to withstand high traffic.
DNS requests work through the following stages:
A records are DNS records that point to particular IP addresses. It is also possible to use an AAAA record or ALIAS record in a round-robin DNS configuration.
- A user searches for a domain name in a web browser.
- The browser checks the local DNS cache.
- If no information is found in the cache, it will query the DNS servers for an A record from the authoritative name server.
But it is not possible to generate multiple CNAME records for the same hostname. If round-robin DNS is applied to a configuration where CNAME records are used then services linked to the same domain, such as email, may stop working. So CNAME records cannot be used in conjunction with any other records within a round robin DNS configuration.
The round-robin DNS queries differ from regular DNS queries in that they deliver multiple IP addresses rather than a single IP address. Round-robin DNS queries make connections with the IP addresses by rotation and in the order that the queries are made.
Although these queries use different IP addresses that correspond to different web servers, they all host the same web services.
The round-robin DNS mechanism was designed to alleviate the high loads that occur from large numbers of clients connecting to the same server. It allows different servers to be used for different clients connecting to the same domain. Round-robin DNS results in pressure being taken off the DNS server so there is less chance of websites failing to load.
Alternative factors for selecting IP addresses in DNS requests could be availability or proximity to the DNS server. Round-robin DNS systems iterate through a set number of IP addresses in numerical sequence. They do not do this by the most recently used IP address or the most immediately available.
The main advantages of round-robin systems of load balancing are that they are easy to understand and implement.
The drawbacks of Round-Robin DNS
Unfortunately, the round-robin DNS function is not without certain limiting factors.
One of these is record caching. If the DNS queries made to a particular website are for high-traffic recursive resolvers, the resolver will cache the website’s IP. This can result in a large amount of traffic to that IP address.
DNS servers maintain the connection to an IP address, even when the corresponding server is offline. So the user that is sent to this IP address will potentially come up against an error page.
Another drawback is that the servers in question do not always have the same capacity. We can measure this in processing power or RAM. It means that some servers can handle more requests than others. But the round-robin DNS system distributes requests equally between servers without taking this into account. This could potentially lead to an uneven load balancing and potentially for low-capacity servers to fail.
Round-robin DNS also isn’t able to account for factors that may affect load balancing. These include geographical location, transaction time, and server load. Other DNS or load-balancing systems give priority to servers based on these factors.
Fortunately, it is possible to address some of these issues. There is a way of detecting the servers that are not responding, then removing them from the round-robin rotation. There are also techniques for compensating for load imbalance. One of these is weighted round-robin configurations or more complex algorithms.
When round-robin load balancing algorithms are weighted, IP addresses and servers are assigned based on their capacity for traffic handling. So a server that can handle more requests will receive more requests. The round-robin circuit will still apply, but the DNS assigns requests according to the capacity of each server.
An example of Round-Robin Configuration
We have seen that when there are IP addresses on multiple web servers, a website can load balance requests using round-robin DNS. Although the domain name and the website are the same, they can be accessed from different IP addresses on different web servers.
With a round robin configuration, each user that visits the website will access a different IP address by numerical sequence. In other words, the system assigns servers and IP addresses in the order that the requests are made.
For example, we could have one domain name with four different web servers and four IP addresses. The routing will follow this pattern:
User 1: goes to IP address 1
User 2: goes to IP address 2
User 3: goes to IP address 3
User 4: goes to IP address 4
User 5: goes to IP address 1
Once users have accessed the four IP addresses, the following user will go to the first IP address, and the round-robin circuit continues in the same order. This ensures that there is an equal spacing of DNS requests for each IP address.
It is possible to view and manage the round-robin DNS facility in the consoles of your computer. You can also turn off the round-robin DNS function by using a simple command. However, it is more convenient to use a suitable DNS service.