Load Sharing with DNS

titleDNS1This article discusses on how to do Load sharing with DNS (Domain Name System).


A DNS based approach is a classical approach to sharing the load between multiple servers. DNS responds to domain name look-up requests issued by clients and returns the corresponding IP address.

DNS is an Internet service that translates domain names into IP addresses. Domain names are alphabetic and easy for humans to remember e.g. www.yourcompany.com, but information on the Internet is delivered using IP addresses. Every time a URL that contains a domain name, the DNS will translate the name into an IP address. For example, www.yourcompany.com would be translated in

The basic idea of DNS load sharing is to associate several IP addresses with a single host name. When the DNS responds to a request, it returns the whole list of addresses to the client. The addresses are then used in a round-robin or load-sharing fashion, thus providing some form of load balancing.

Three types of DNS load sharing techniques will be examined here. These are as follows:

  • Backup Server via Redirected Secondary DNS
  • Load Sharing with Round Robin DNS
  • Dynamic Load Balancing DNS (dlbDNS)

Backup Server via Redirected Secondary DNS

This is the simplest of the DNS configuration options. It allows you to create a backup server for the primary web server, by taking advantage of the fact that all domain names have at least two nominated name servers – a primary name server and a secondary name server – from which their IP address may be determined.

Ordinarily, both name servers hold a record for the name of the web server with the same IP address. For example


However, there is no reason why the web server cannot be the primary name server for itself. If we set up two identical servers, we can make the web server its own primary name server and give the secondary server a different IP address for the web server. For example:


The IP address of the web server is requested by other name servers directly from the web server’s own DNS service. If, for any reason, the web server fails, the primary name server will no longer be available and DNS requests will be redirected to the secondary name server. This returns the IP address of the backup server rather than the primary server, so client requests will succeed.

It should be noted that with this approach, no provision is made for load sharing. The backup server is never accessed until the primary server becomes unavailable, no matter how busy it might be. Note that unavailable means totally unavailable. For example, if the httpd daemon crashes but the machine is still capable of DNS resolution, the switch from primary server to secondary server will not occur.

Load Sharing with Round Robin DNS:

One of most common implementations of DNS is the Berkeley Internet Name Domain (BIND). This allows address records (A records) to be duplicated for a specific host, with different IP addresses. The name server then alternatively rotates addresses for any one name that has multiple A records, and is known as DNS round robin.

As an example, your company has three web servers. Their real names and IP addresses are as follows:


You want to set up the servers so that DNS requests by clients (in this case, web server access) are round robin rotated. This is accomplished by placing multiple A records in the authoritative name server files.

For the above example, we want all clients to access our site by using www.yourcompany.com, but we want these requests to be shared between our three servers using DNS round robin. To do so, we need to place the following A records in the name server file:


Note the ‘.’ after the name www.yourcompany.com on each A record. This is mandatory.

A Time To Live (TTL) field is often added to the A records. The TTL value is the maximum time that the information should be held to be reliable. By setting the TTL to a fairly small amount time e.g. 60 seconds, the effectiveness of the distribution can be maximized. A lower value may be specified, but this causes more DNS traffic in updates, which improves the load sharing on the web servers at the expense of increasing the local on the name server.


When a DNS request for an IP address is received, BIND returns one of the IP addresses and makes a note of it. The next request will then return the next IP address in the file and so on until the last one, after which BIND returns to the first address again.

Advantages of DNS Round Robin:

An obvious advantage of using DNS Round Robin for load distribution is that it is seamless to the user. It is also simple and cost-effective to implement. It is standard software in most systems or else may be obtained at no or low cost. For this reason, it is very effective for small to medium size businesses or organisations and it is extremely popular among ISPs, e-commerce sites, universities and other cost sensitive sites.

Disadvantages of DNS Round Robin:

It should be noted that DNS is a load sharing mechanism rather than a load balancing mechanism. It does not gauge the “load” on the server in any way, but rather it shares the load among multiple hosts. One or more of the hosts in the pool will tend to get more activity than the other servers. DNS Round Robin should be quite effective up to about 10 servers per virtual cluster.

DNS has no way of detecting physical failure e.g. when the hard disk on server2 (www2) fails. As requests come in for www.yourcompany.com, the DNS will continue to forward one out of every three requests to www2 – which will fail. Effectively, 33% of all requests to www.yourcompany.com are now connecting to a black hole. This is an improvement over having just one web server and having all the requests being lost due to a hardware failure, but only to a certain degree.

It is very common for a computer to request data from the same host several times in any given session. It is also common for many hosts from the same site to make requests from the same servers. Usually, these requests are made to a local name server that in turn ask another name server for the resolution of the domain. In order to minimize network traffic these responses are cached – possibly on each name server along the way. This helps the network to respond quickly with domain name resolution, but it can also defeat the round-robin load distribution.

However, this caching problem may be resolved by using the TTL value. The protocol requires that local and intermediate DNS servers dump these entries from their cache when the TTL runs out. Most systems, such as Solaris, NT and Linux (and others) support BIND 4.9 and later versions. DNS round robin supports pools of servers for any applications, not just web servers. Pools of web, email, ftp, database and other servers can all be setup to load share using DNS.

Dynamic Load Balancing DNS: dlbDNS

Another approach to solving the problem of network traffic congestion is to add a dynamic load balancing feature to the existing DNS.

Distributing a request across servers can be implemented by monitoring the servers regularly and directing the request dynamically to the ‘best server’. This way of dynamically directing a request across multiple servers based on the server load is called dynamic load balancing. This feature can be added to the pre-existing DNS, as it already plays a prominent role in resolving client requests and can be configured to direct client requests across multiple servers in an effort to avoid network traffic congestion. Here, the ‘best server’ refers to the server with the best rating, based on a rating algorithm.

There are several load balancing models available. The model implemented by dlbDNS is an internal monitoring system, that monitors the performance of the servers and provides feedback to the DNS. It is easy to maintain and administrate. Other advantages include closeness to the source of addressable problems and no security hazards.

As there are several load balancing models available, there are also a number of load balancing algorithms available. The rating algorithm implemented in dlbDNS, which determines the best server, is based on the number of users and load average shown. The algorithm is reasonable, as it favors the host(s) with the smallest number of unique logins and lower load averages.

The Server-Side Algorithm is added to the pre-existing DNS feature. During configuration, a new attribute called DNAME is added to distinguish the hosts taking part in dynamic load balancing. If the service requested is of type DNAME, do the following:

  1. Determine the set of participating servers for this service
  2. Request ratings from all participating servers by establishing a concurrent connectionless (UDP) connection with each server
  3. Using the ratings returned, determine the best server
  4. Handle error conditions such as:
    • Server is too busy to return the rating within the time frame
    • The rating returned by the server gets lost on its way back to the dlbDNS
    • All servers have same rating
    • A server is down

Rating Demon Algorithm is run on each server taking part in dynamic load balancing and is as follows:

  1. Receive request for rating from dlbDNS and respond by returning the host rating
  2. Calculate the host rating once every minute rather than calculating it at the time of request, as quick response time is a most important factor
  3. Ensure the host rating is updated every minute, independent of the dlbDNS request
  4. Handle error conditions such as dlbDNS closing the UDP sockets without waiting for host response

Implementation of the dlbDNS provides efficient utilization of system resources and ensures that facilities newly added to the existing network will be utilized. Since DNS is used, applications such as FTP and TELNET will also utilize dlbDNS.

This dlbDNS algorithm was proposed by the Computer Science department of Wichita State University, due to the uneven distribution of load across the servers thus causing major problems for the department. It should be noted that there is further work to be done on this approach. In particular the rating algorithm is incomplete. An algorithm that takes into account the number of processors, CPU and memory utilization would make the rating algorithm more efficient. Also, a more extensible design is needed, as Linux servers are the only servers that can participate in the dynamic load balancing scheme.


The most common implementation of DNS load sharing is most certainly the DNS Round Robin technique. It is very feasible for small to middling companies and organizations. However, it is not sufficient for larger organizations and they should probably take into account other load balancing sc


Here are list of websites that I referred to, when researching this topic.

It should be noted that all my material was drawn from these sites and papers, as well as my images.

Ref source: http://ntrg.cs.tcd.ie/undergrad/4ba2.01/group8/DNS.html

About NhocConan

A super lazy guy who tries to write tech blog entries in English.He is lazy, so he can only write when he is in a good mood or when he is tired of coding.

Leave a comment

Your email address will not be published. Required fields are marked *