Alibaba Cloud DNS supports configuring multiple record values under the same hostname and resolution line. It distributes DNS traffic to different servers through record-value load balancing policies: round-robin and weight. Round-robin returns all record values and rotates the response order, while weight probabilistically returns one record value based on the weight ratio.
Policy comparison
When multiple DNS records are configured under the same hostname and resolution line, the system supports two load balancing policies: round-robin and weight. The response behavior differs as follows:
Round-robin: returns all record values for the line and rotates their order in each response. Clients typically access the first address, which achieves even traffic rotation.
For example, if you configure three addresses
1.1.XX.XX,2.2.XX.XX, and3.3.XX.XX:The first query returns: 1.1.XX.XX, 2.2.XX.XX, 3.3.XX.XX
The second query returns: 3.3.XX.XX, 1.1.XX.XX, 2.2.XX.XX
The third query returns: 2.2.XX.XX, 3.3.XX.XX, 1.1.XX.XX
Weight: returns only one record value per query, based on the probability derived from the preset weight ratio.
For example, if the weight ratio of the preceding three addresses is set to 2:1:1, each query returns:
1.1.XX.XXwith an approximate probability of 50%2.2.XX.XXwith an approximate probability of 25%3.3.XX.XXwith an approximate probability of 25%
Key differences
Item | Round-robin | Weight |
Response | Returns all record values for the line | Returns only one record value based on probability |
Ordering | Rotates all addresses in round-robin order | Selects a single address according to weight ratio |
Traffic distribution | Roughly even traffic across addresses | Traffic distributed according to weights |
Use case | Even load sharing across multiple servers | Differentiated traffic allocation based on server capacity |
Supported record types
The load balancing policies supported by each record type are as follows:
Round-robin: A, AAAA, NS, MX, SRV, TXT, CAA, SVCB, explicit URL forwarding, and implicit URL forwarding
Weight: A, AAAA, CNAME, and ALIAS
Policy limits
Record status: Only enabled records participate in responses. Records that are disabled or locked are not returned under either policy.
Effective scope: Both policies take effect independently for each combination of hostname + DNS line. The default line and specific DNS lines can both be configured, and different lines do not affect each other.
Wildcard DNS records: Wildcard DNS records do not support weight configuration and respond based on the round-robin policy.
Record quantity: The maximum number of DNS records that can be configured with weight under a single domain name and DNS line is:
Free Edition: 10
Personal Edition and Enterprise Ultimate Edition: 100
Premium Edition: Unlimited
Procedure
Round-robin is the default load balancing policy. For record types that support round-robin, after you configure multiple record values under the same hostname and DNS line, responses are returned in round-robin order. The weight policy must be manually selected and weight values must be set.
Configure a load balancing policy when adding a record
On the Alibaba Cloud DNS - Public Zone page, click the target domain name to go to the Settings page.
On the Settings page, click Add Record.
In the Add Record panel, select a record type, enter the Hostname, Query Source, and TTL, add one or more Record Values, and select a Record Value Load Balancing Policy:
Round Robin: The default policy. All record values are returned and rotated in each response.
Weight: Set a weight value for each record value. Valid values: 0 to 100. The default weight ratio is 1:1. If a weight value is 0, Alibaba Cloud DNS does not return this record value.
Click OK to add the DNS record.
Modify the load balancing policy
On the Alibaba Cloud DNS - Public Zone page, click the target domain name to go to the Settings page.
On the Settings page, click Edit in the Actions column of the target record.
In the dialog box that appears, modify the Record Value Load Balancing Policy. If you set it to Weight, modify the weight value of each record value.
Response behavior examples
Round-robin behavior
Assume that three servers (with IP addresses 1.1.XX.XX, 2.2.XX.XX, and 3.3.XX.XX) provide the same service for one domain name. Three A records are configured as follows:
Record type | Hostname | DNS line | Record value |
A | www | Default | 1.1.XX.XX |
A | www | Default | 2.2.XX.XX |
A | www | Default | 3.3.XX.XX |
When weight is not enabled, Alibaba Cloud DNS returns all three DNS records to the LocalDNS and rotates the response order based on the round-robin policy. If the LocalDNS returns all IP addresses to the website visitor, the visitor's browser typically accesses the first IP address in the list.
This approach can reduce the load on a single server to some extent, but it cannot distinguish between servers or reflect their current running status.
Default weight behavior (1:1:1)
After weight is enabled, the default weight ratio is 1:1:1. Alibaba Cloud DNS returns one of the IP addresses according to the 1:1:1 probability distribution. Example DNS query results:
Query from Region1 returns 1.1.XX.XX
Query from Region2 returns 2.2.XX.XX
Query from Region3 returns 3.3.XX.XX
Query from Region4 returns 1.1.XX.XX
Query from Region5 returns 2.2.XX.XX
Query from Region6 returns 3.3.XX.XX
...Custom weight behavior (2:1:1)
You can customize the weight ratio. In DNS responses, IP addresses are returned according to the configured probability, so DNS traffic is distributed by weight.
For example, if the weight ratio of the preceding three DNS records is set to 2:1:1, the probability of returning 1.1.XX.XX is approximately twice that of 2.2.XX.XX and 3.3.XX.XX.
Example DNS query results:
Query from Region1 returns 1.1.XX.XX
Query from Region2 returns 2.2.XX.XX
Query from Region3 returns 3.3.XX.XX
Query from Region4 returns 1.1.XX.XX
Query from Region5 returns 1.1.XX.XX
Query from Region6 returns 2.2.XX.XX
...FAQ
DNS results do not match the weight ratio
Causes
This is expected. The weight policy returns record values based on probability, so the actual DNS results may not exactly match the configured ratio. The main reasons are:
LocalDNS caching: After an ISP DNS server (LocalDNS) obtains a DNS response, it caches the result for the TTL period. During the cache period, users using the same LocalDNS will resolve to the same record value instead of switching according to weight.
Probability variance: After the cache expires and LocalDNS queries Alibaba Cloud DNS again, the result is still selected probabilistically and may return the same record value as before. The weight ratio is probability-based, not strict round-robin, so small sample sizes may not precisely match the configured ratio.
For example, users in Shanghai and Beijing may use different LocalDNS servers, LocalDNS A and LocalDNS B. When these LocalDNS servers query Alibaba Cloud DNS, the response follows the configured weight policy. However, within the TTL period, all users using the same LocalDNS will receive the same DNS result.
Verify the weight ratio
To bypass LocalDNS caching, send repeated queries directly to the domain’s authoritative NS server and count how often each record value is returned.
Replace the authoritative NS address in the command with the domain’s actual authoritative NS address.
dig +short A dns-example.com @ns1.dns-example.com