All Products
Search
Document Center

Weighted Round Robin

Last Updated: Aug 19, 2019

Overview

Alibaba Cloud DNS provides weighted round robin for you to configure multiple IP addresses or domain names for a host record. When responding to a DNS request, Alibaba Cloud DNS returns different DNS records based on the preset weights of IP addresses or domain names. This way, traffic is forwarded to different servers, and load balancing is achieved.

Prerequisite

DNS records that have the same type (A or CNAME), host record, and ISP line.

Limits

Weighted round robin applies to DNS records that have the same type, host record, and ISP line. The following table describes these limits in details.

Item Supported Not supported
Type A or CNAME Other types
Status Enabled Paused, Locked, and wildcard DNS records
Weighted round robin If DNS records have the same type, host record, and ISP line, the free edition supports weighted round robin for a maximum of 10 DNS records. The paid edition supports weighted round robin for a maximum of 90 DNS records.
Note: The default weight ratio is 1:1:1 for DNS records configured with three IP addresses or domain names.
ISP line You can set it to a default line or a specific line for A or CNAME records.
Note: The weights are independent of each other in different lines.
DNS records for different lines


Settings

  1. Log on to the Alibaba Cloud DNS console. The Manage DNS page appears.

  2. On the Domains tab, click the domain name that you want to configure.
    目录E01

  3. On the DNS Settings page that appears, click Weighted Round Robin in the left-side navigation pane. On the page that appears, click Enable in the Actions column corresponding to the domain name. The default weight ratio is 1:1. If the default weight ratio is retained, Alibaba Cloud DNS returns IP addresses to DNS requests based on this ratio.
    权重配置目录02
    加权轮询提示

  4. On the Weighted Round Robin tab, click Set Weight in the Actions column corresponding to the subdomain. After you set the weight ratio, Alibaba Cloud DNS returns IP addresses in a DNS response based on this ratio.
    设置权重E04

Effect

Weighted round robin is not enabled

Assume that you have three servers whose IP addresses are 1.1.1.1, 2.2.2.2, and 3.3.3.3. The IP addresses of these servers map to one domain name. The following table describes the DNS records of the domain name.

Type Host record ISP line Record value
A www Default 1.1.1.1
A www Default 2.2.2.2
A www Default 3.3.3.3

When a local DNS accesses Alibaba Cloud DNS, Alibaba Cloud DNS returns all the three DNS records to the local DNS . The local DNS sends all the IP addresses to a website visitor’s browser, and the browser randomly accesses one of the IP addresses.

Authoritative DNS servers can reduce the server workloads to some extent, but it cannot differentiate between the servers or reflect the current running status of each server.

Default weight

When weighted round robin is enabled, the default weight ratio is 1:1:1. Alibaba Cloud DNS returns three IP addresses in turn based on the default weight ratio to respond to access requests of website visitors. The returned DNS records are as follows:

  1. 1.1.1.1
  2. is returned when User 1 attempts to visit the server. 2.2.2.2
  3. is returned when User 2 attempts to visit the server. 3.3.3.3
  4. is returned when User 3 attempts to visit the server. 1.1.1.1
  5. is returned when User 4 attempts to visit the server. 2.2.2.2
  6. is returned when User 5 attempts to visit the server. 3.3.3.3
  7. is returned when User 6 attempts to visit the server. ...

Specified weight

After weighted round robin is enabled, you can set weight. Alibaba Cloud DNS returns IP addresses to a DNS request based on this ratio. Traffic is also forwarded to different servers based on this weight ratio. For example, when the weight ratio of the above three DNS records is set to 2:1:1, the DNS records are returned as follows:

  1. 1.1.1.1
  2. is returned when User 1 attempts to visit the server. 2.2.2.2
  3. is returned when User 2 attempts to visit the server. 3.3.3.3
  4. is returned when User 3 attempts to visit the server. 1.1.1.1
  5. is returned when User 4 attempts to visit the server. 1.1.1.1
  6. is returned when User 5 attempts to visit the server. 2.2.2.2
  7. is returned when User 6 attempts to visit the server. ...

Note

You may find that DNS records are not returned based on the weight settings during the test. This is a common occurrence. The cause is that weighted round robin is a coarse-grained method to schedule traffic based on the weight of an IP address in an DNS record. Weighted round robin is set to process requests from local DNSs. However, local DNSs request the authoritative DNS (Alibaba Cloud DNS) only once within the time to live (TTL) period.

For example, a domain name is accessed by users in both Shanghai and Beijing. It is assumed that the Shanghai users use local DNS A and the Beijing users use local DNS B. When local DNS A and local DNS B initiate requests to Alibaba Cloud DNS, Alibaba Cloud DNS returns IP addresses based on the weight settings. However, all users who use the same local DNS obtain the same IP address within the TTL period.