edit-icon download-icon

DNS load balancing

Last Updated: Oct 10, 2017

In large-scale network applications, multiple servers are often used to provide the same service. This method is called load balancing. Using load balancing can distribute client requests across a group of servers and balance the workloads of these servers.

Principle

The idea of using Alibaba Cloud DNS for server load balancing is to assign different IP addresses to website visitors.

For example, three servers have three different IP addresses, which are 1.1.1.1, 2.2.2.2, and 3.3.3.3. The following three A records are configured for these IP addresses:

Record Type Host ISP Line Value Weight
1 A www default 1.1.1.1 600
2 A www default 2.2.2.2 600
3 A www default 3.3.3.3 600

When a local DNS accesses the authoritative DNS, the authoritative DNS returns all three IP addresses to the local DNS. Then, the local DNS returns all these IP addresses to site visitors. As a result, each visitor randomly accesses one of these IP addresses.

This is how authoritative DNS servers work without load balancing. It can reduce the the server workloads to some extent, but it cannot differentiate between the servers or reflect the current running status of each server.

  • Round robin load balancing

    Round robin method is a simple way to do DNS load balancing.

    For authoritative DNS servers with load balancing, when receiving requests from a site visitor, the authoritative DNS servers poll the three A records according to the weights of the DNS records (default to 1:1:1) and return these IP addresses in turn.

    1.1.1.1 is returned when User1 attempts to visit the site
    2.2.2.2 is returned when User2 attempts to visit the site
    3.3.3.3 is returned when User3 attempts to visit the site
    1.1.1.1 is returned when User4 attempts to visit the site

  • Weighted round robin

    When the records are configured with different weights (such as 2:1:1), the results are as follows:

    1.1.1.1 is returned when User1 attempts to visit the site
    2.2.2.2 is returned when User2 attempts to visit the site
    3.3.3.3 is returned when User3 attempts to visit the site
    1.1.1.1 is returned when User4 attempts to visit the site
    1.1.1.1 is returned when User5 attempts to visit the site
    2.2.2.2 is returned when User6 attempts to visit the site

Usage

If you have multiple servers and want to balance web traffic across these servers, you can use DNS load balancing.

After activating Alibaba Cloud DNS, you can manually enable or disable DNS load balancing and set different weight values for different DNS records. The default weight value is 1.

Rules

DNS load balancing is available only for multiple A records with the same host and ISP line. Besides,

  • Weighted round robin only supports A records.
  • Disabled or locked A records and A records with wildcard are not supported.
  • Weighting is valid only for multiple A records with the same host and ISP line.
  • The default ratio of weight values is 1:1:1:… .
Thank you! We've received your feedback.