Set load balancing policies

更新时间:
复制 MD 格式

Global Traffic Manager 3.0 supports two levels of load balancing: Load Balancing Policy and Load Balancing Policy, for flexible control over DNS responses.

Configure Load Balancing Policy

The Load Balancing Policy includes: Round Robin, Global Availability, Ratio, and Nearest Source. Choose a policy based on your business scenario.

Policy details

Round Robin

Returns all address pools for every DNS query, rotating their order each time. Clients typically use the first address in the list.

  • 1st query: Address Pool 1, Address Pool 2, Address Pool 3

  • 2nd query: Address Pool 3, Address Pool 1, Address Pool 2

  • 3rd query: Address Pool 2, Address Pool 3, Address Pool 1

  • 4th query: Address Pool 1, Address Pool 2, Address Pool 3

Important

You cannot set the Load Balancing Policy to Round Robin in the following scenarios:

  • IPv4 and domain-type address pools coexist.

  • IPv6 and domain-type address pools coexist.

Scenarios

  • Multi-active data center architectures that distribute traffic evenly.

  • Simple traffic distribution where precise allocation is unnecessary.

Recommendation: DNS caching and client behavior may skew actual traffic from a strict 1:1:1 ratio, but distribution balances out over time.

Global Availability

Returns the address pool with the lowest sequence number (lower = higher priority). If the top-priority pool is unavailable, the next one is returned. Preemptive Mode can be Preemptive Mode or Non-Preemptive Mode.

  • Preemptive Mode: Switches back to a higher-priority pool immediately when it recovers.

    Example: Address Pool 1 has sequence number 1, Address Pool 2 has 2, and Address Pool 3 has 3. If Address Pool 1 is available, always return it.

    If Address Pool 1 fails, return Address Pool 2. If both Pools 1 and 2 fail, return Pool 3. If Pools 1 and 2 recover, return Pool 1.

  • Non-Preemptive Mode: Keeps using the current pool even after a higher-priority pool recovers.

    Example: Address Pool 1 has sequence number 1, Address Pool 2 has 2, and Address Pool 3 has 3. If Address Pool 1 is available, always return it.

    If Address Pool 1 fails, return Address Pool 2. If both Pools 1 and 2 fail, return Pool 3. If Pools 1 and 2 recover, continue returning Pool 3.

Scenarios

Scenario

Recommended mode

Reason

Active-standby disaster recovery

Non-preemptive mode

Prevents data loss from inconsistency between primary and standby data centers. Switching back before new standby data syncs to the primary center could cause errors or data loss.

Performance tiering

Preemptive mode

Prioritizes high-performance or low-latency pools. Switches traffic back immediately when those pools recover.

Cost optimization

Preemptive mode

Prioritizes low-cost pools (such as subscription resources). Falls back to pay-as-you-go pools only during failures and switches back immediately on recovery.

Ratio

Assign each address pool an integer weight from 1 to 100. GTM distributes DNS queries proportionally — higher-weight pools are returned more often.

Scenarios

  • Canary release: route a small percentage of traffic (for example, 5%) to a new address pool to validate stability.

  • Proportional traffic splitting: distribute traffic based on each data center’s capacity.

Recommendations

  • Actual traffic ratios may differ from configured weights due to multi-level DNS caching. Calibrate weights using business monitoring data, not DNS query statistics alone.

  • Keep weight differences at least 10 points apart to make adjustments noticeable.

Nearest Source

GTM matches the DNS query source IP to the most specific available address pool. If multiple pools match, the one with the lowest sequence number is returned.

Scenarios

  • Globally or nationally distributed data centers where users need region-optimal access.

Recommendation
Always configure a default line to handle undefined sources and ensure global availability.



Procedure

  1. Go to Alibaba Cloud DNS – Global Traffic Manager, find your target domain, and open its configuration page.

  2. Click the current inter-pool load balancing policy below the domain (such as Round Robin) to open the configuration panel.

    image

  3. Click Configure Load Balancing Policy.

    This button is on the left side of the Load Balancing Policy Configuration table in the instance topology view.

  4. Select Load Balancing Policy. Except for Round Robin, other policies require additional per-pool configuration.

    • Global Availability: Assign each address pool a sequence number (lower = higher priority) and choose either preemptive or non-preemptive mode based on the guidance above.

    • Ratio: Assign each address pool an integer weight between 1 and 100.

    • Nearest Source: Assign an address pool for each planned source (such as region, country, province, or ISP), and always configure a default address pool.

    image

  5. Verify the policy by checking DNS records or querying public DNS servers.

    dig @223.5.5.5 your-domain.com +short
    dig @8.8.8.8 your-domain.com + short

Configure Load Balancing Policy

The Load Balancing Policy supports: Round Robin, Global Availability, Ratio, and Nearest Source.

Policy details

Round Robin

Returns all addresses in the pool for every DNS query, rotating their order each time. For example:

  • 1st query: IP1, IP2, IP3

  • 2nd query: IP3, IP1, IP2

  • 3rd query: IP2, IP3, IP1

  • 4th query: IP1, IP2, IP3

Note

Clients receiving multiple IP addresses typically select one based on internal logic, such as best route or the first IP in the list.

Sequential

Returns the address with the lowest sequence number (lower = higher priority). If the top-priority address is unavailable, the next one is returned. Failback behavior uses either preemptive mode or non-preemptive mode.

Preemption Mode: Switches back to a higher-priority address immediately when it recovers.

Non-preemptive mode: Keeps using the current address even after a higher-priority address recovers.

Example: IP1 has sequence number 1, IP2 has 2, IP3 has 3.

In preemptive mode:

If IP1 is available, always return IP1.

If IP1 fails, return IP2. If both IP1 and IP2 fail, return IP3. If IP1 and IP2 recover, return IP1.

In non-preemptive mode:

If IP1 is available, always return IP1.

If IP1 fails, return IP2. If both IP1 and IP2 fail, return IP3. If IP1 and IP2 recover, continue returning IP3.

Warning

If your disaster recovery setup uses one-way synchronization between data centers, use non-preemptive mode. Normally, GTM returns IP1. When IP1 fails, GTM returns IP2. Data created while users access IP2 won’t sync back to IP1 immediately. With preemptive mode, GTM would switch back to IP1 on recovery, potentially causing service errors.

weight

Assign different weights to individual addresses to distribute them proportionally. Useful for traffic shifting between old and new data centers.

Note

Weights must be integers from 1 to 100 (inclusive). Do not set weight to 0.

Important

If DNS responses occasionally don’t match your weight settings during testing, this is expected. Weighting provides coarse-grained traffic control — it applies to local DNS requests, and each local DNS queries authoritative DNS (Alibaba Cloud DNS) only once per TTL period.

For example, Shanghai users use localdnsA and Beijing users use localdnsB. When each queries GTM, the weight policy applies. Within the TTL window, all users sharing the same local DNS see identical results.

Source Nearest

Intelligent DNS resolution. GTM returns different IP addresses based on the query source, enabling nearest-access routing.

Query source: GTM uses the exit IP of the client’s local DNS for routing. If the local DNS supports ECS (edns-client-subnet), GTM uses the client’s actual IP for more accurate routing.

Procedure

  1. Go to Alibaba Cloud DNS – Global Traffic Manager, find your target domain, and open its configuration page.

  2. In the configuration interface, click the policy name below the address pool icon, then select Configure Load Balancing Policy in the pop-up window.

  3. Select an appropriate load balancing policy (between addresses).

  4. Except for Round Robin, other policies require additional per-pool configuration. For example:

    • Sequential: Assign each address a sequence number (lower = higher priority) and choose either preemptive mode or non-preemptive mode based on the guidance above.

    • Weight: Set an integer weight from 1 to 100 for each address pool.

    • Source Nearest: Assign an address pool for each planned source (such as region, country, province, or ISP), and always configure a default address pool.