In the world of internet infrastructure, there are many ways to distribute traffic across a set of servers. One such method is round-robin DNS. Round-robin DNS is a technique that distributes traffic across multiple servers by rotating through a list of IP addresses associated with a single hostname. While this approach may seem like a quick and easy way to distribute traffic, there are some significant drawbacks to consider.
In this blog post, we'll discuss the pros and cons of round-robin DNS, and explain why using a load balancer is often a better option.
Round-Robin DNS is a redirection methodology that directs DNS requests to one of a number of IP addresses, thereby achieving load balancing and high availability in a domain's infrastructure.
DNS (Domain Name System) is a protocol that provides a mapping between domain names and their corresponding IP addresses. A round-robin DNS configuration involves assigning multiple IP addresses to a single domain name, allowing DNS servers to alternate between them when responding to DNS queries.
The result of round-robin DNS is that requests made to the domain name are distributed relatively evenly across the different IP addresses. This can help to spread website traffic and reduce the load on individual servers, which in turn can enhance website performance and stability. In this way, a degree of scalability, redundancy, and reliability can be achieved (albeit limited).
How does DNS round-robin work?
If you were to reduce load balancing to the simplest definition possible you would pretty much be describing round-robin DNS. It is a way of balancing load amongst a pool of servers. And, like most things (I find!), is best described in a network diagram:
What we see here is that requests that are sent to one location, such as www.loadbalancer.org, are resolved to one real server within a pool of servers.
This spreads the load, but it doesn't balance it, which is one of the major drawbacks of using round-robin DNS.
The above diagram simply illustrates the basics of round-robin DNS. What it doesn't show you is that there is quite a bit of randomness to which records are handed out. They don't necessarily go in order; it could go Server 1, Server 1, Server 2, Server 1, Server 2, Server 2. Whilst the distribution ends up being roughly equal, the requests are not sequential.
Indeed, if you took this scenario and scaled it up, this would result in an uneven spread of load amongst the servers. Yes, you will be able to service more requests than would be possible with just one server. But there is still the chance, with this kind of implementation, that one of those servers could become overwhelmed with requests, whilst another is running relatively idle. Not an effective way to manage your resources.
So what's the point of using round-robin DNS...?
Why use round-robin DNS?
The short answer is probably because you need 'something' as you have a pool of servers that are providing access to a common resource.
Most probably, you have more traffic than can be serviced by a single server so you are trying to spread that load across a number of servers so that your service and your customer are not becoming constrained.
At this point you should seriously be asking yourself why you don't have a load balancer yet (!), but perhaps you're thinking...buying a load balancer is an extra expense; round-robin DNS is actually pretty simple to set up; or perhaps, round-robin DNS is doing the job (for now).
And so, at this point, it makes sense (for the sake of completeness) to address the apparent benefits of using round-robin DNS.
What are the benefits of round-robin DNS?
There are two apparent advantages:
1.The primary benefit of round-robin DNS is its simplicity.
It requires no additional hardware or software and can be implemented using existing DNS infrastructure. This makes it an attractive option for small websites or organizations with limited resources. It also has low resource requirements, and the configuration is relatively simple.
2.Round-robin DNS can also provide a level of fault tolerance.
If one of the servers in the list becomes unavailable, the DNS server will simply remove it from the rotation, and traffic will be directed to the remaining servers. This can help ensure that your website or application remains available even in the event of a server failure.
What are the drawbacks of round-robin DNS?
Right, enough extolling the virtues of round-robin DNS. We would never suggest it as a solution for anything — and not just because we are in the business of selling load balancers (yes, really!)!!! The bad most definitely outweighs the good when it comes to DNS round-robin, in a way that significantly limits its effectiveness. Here's why...
1.One major issue is that it provides no intelligence or awareness of server load.
It simply rotates through a list of IP addresses, regardless of whether the servers associated with those addresses are overloaded or underutilized. This can result in uneven distribution of traffic, which can cause some servers to become overloaded while others remain idle.
2.Another issue is that round-robin DNS has no built-in mechanism for session persistence.
If a user establishes a session with one server and is then directed to another server, they may lose their session data and be forced to start over. This can result in a poor user experience, and increased support costs.
3.Round-robin DNS is a simple and static solution that does not perform any form of real-time monitoring.
As a result, it cannot dynamically adjust to changing traffic conditions or network availability issues. Additionally, since Round Robin DNS does not provide advanced load balancing features (such as session persistence or health checks), it may not be suitable for applications that require these features.
4.Round-robin DNS wasn't made to balance load.
DNS is designed for resolving names to IP addresses, and these are long-lived records. Load balancing, however, requires you to be able to remove a server from a pool at a moments notice. That is not something that can be achieved with DNS alone.
5.Round-robin DNS is fire and forget.
It doesn't keep track of where it is sending requests, so if you require persistence it won't work for you. In fact, DNS doesn't even keep the resource records within a set in any particular order. Sure you have a defined set of addresses it can go to, but which one is picked is anybody's guess. All of this means it fires indiscriminately. In fact, in the majority of cases, the DNS server doesn't perform any health checking of the endpoints it is serving records for so that means the record you get served could be for a server which is not available.While there are some notable exceptions (like AWS Route53 and NS1 where you can add health checks), these are very much the exception, and not the rule.
The bottom line? 'Good enough' isn't good enough. When you need something better than the bare minimum, you need something better than round-robin DNS. And this will always be a load balancer.
Why are load balancers a better option?
In a nutshell, load balancers monitor server load and adjust traffic distribution accordingly, ensuring that traffic is distributed evenly and efficiently. They can also maintain session persistence by directing subsequent requests from a user to the same server that initially served their request.
Load balancers address the drawbacks of round-robin DNS by providing intelligent distribution of traffic and session persistence.
In addition to these benefits, load balancers provide other advanced features such as SSL offloading, content caching, and DDoS protection. They can also integrate with other infrastructure components such as firewalls, web application firewalls, and intrusion detection systems to provide a comprehensive security solution.
While round-robin DNS may seem like a simple and convenient way to distribute traffic across multiple servers, it has significant limitations that can negatively impact performance and user experience.
Load balancers provide a much more robust and intelligent solution that addresses these limitations and provides additional features and capabilities. So, if you are considering a traffic distribution solution for your website or application, a load balancer is almost always the better option.