This document describes how to perform canary switching to smoothly migrate the business traffic of a domain name from its origin to Tencent Cloud EdgeOne by using the traffic scheduling feature.
Objective of the Document
It may take you 10 minutes to read this document, which helps you:
1. Understand what is traffic scheduling management.
2. Understand how to use the traffic scheduling feature to perform canary switching for traffic migration while guaranteeing high service availability.
Background
After you purchase the Tencent Cloud EdgeOne service, you need to switch the traffic of your website from the origin or other service providers to EdgeOne. A conventional solution requires you to use a tool and access a node for testing and, if the test succeeds, switch the traffic once and for all with one click. This may cause issues in some regions, resulting in availability degradation or bursts of traffic at the origin.
A better solution is to perform canary switching to achieve smooth business migration with guaranteed high service availability. EdgeOne provides the traffic scheduling feature for you to control the canary switching progress by specifying custom traffic migration ratios.
Prerequisites
1. You have added a site, purchased the EdgeOne Enterprise plan, and connected the site to EdgeOne in CNAME access mode. For more information, see Adding Sites.
2. You have added the domain name for canary switching in the EdgeOne console. For more information, see Connecting via CNAME.
Use Cases
Assume that you want to migrate the traffic of a site, whose domain name is huidu.example.com. Currently, the traffic is fully directed to the origin server, whose address is origin.example.com.
You plan to switch the traffic to EdgeOne in canary mode by specifying the traffic migration ratio of 1% for the first stage, 30% for the second stage, and 100% for the third stage.
Instructions
Step 1. Add an initial canary switching policy
1. Log in to the EdgeOne console, select Site List from the left navigation, find the site example.com that the domain name belongs to from the list, and click Site to enter the site management page.
2. Upon entering the site, select Domain Name Service > Traffic Scheduling Management from the menu bar. This will take you to the Traffic Scheduling Management page. Here, click on Add Scheduling Policy.
3. On the domain selection page, choose the domain name huidu.example.com that requires canary switching, and click Create.
4. On the 'Add Service Provider' page, as this scenario involves migration from the origin, enter the origin domain name origin.example.com. The service name can be customized, such as "Origin Domain Name". After completing the addition, click Next.
5. In the Configure policy step, add an initial canary switching policy and click Submit. Set the weight of the service provider origin domain name to 99 and that of EdgeOne to 1. This policy means to switch 1% of traffic from the origin to EdgeOne. You can increase the traffic migration ratio later if the service remains stable.
Step 2. Start canary switching
1. Configuring DNS
Upon completion of policy addition, EdgeOne assigns a CNAME record for traffic scheduling to the domain name. This CNAME record is identical to the default CNAME record of the domain name. You are required to configure the CNAME record at your DNS service provider to activate the traffic scheduling policy. For guidance on domain name resolution switching, refer to Step 4 in Connecting via CNAME.
2. Verifying the Implementation Status
You can run the nslookup or dig command to check the switching result.
For Windows systems
macOS or Linux
In the Windows system, open the cmd program. For example, with the domain name huidu.example.com, you can run the following command in cmd: nslookup -qt=cname huidu.example.com. Based on the parsing result, you can view the CNAME information of this domain.
In this example, you have specified the traffic migration ratio of 1%. Therefore, if the traffic switching is successful, about 1% of the returned CNAME addresses are provided by EdgeOne. You can run the command several times.
You can use the dig command for verification. For instance, with the domain name huidu.example.com, you can run the command dig huidu.example.com in the terminal. Based on the results of the command execution, you can view the CNAME information of this domain name.
In this example, you have specified the traffic migration ratio of 1%. Therefore, if the traffic switching is successful, about 1% of the returned CNAME addresses are provided by EdgeOne. You can run the command several times.
3. Monitor Traffic Changes
Navigate to Data Analysis > Traffic Analysis and add a filter condition where the host equals huidu.example.com. Observe the changes in the traffic trend curve. For instance, if the current total bandwidth is 100 Mbps, when 1% is switched to EdgeOne, the bandwidth curve on the EdgeOne console will increase to 1 Mbps.
Step 3. Increase the traffic migration ratio
To increase the canary traffic ratio to 30%, navigate to the traffic scheduling management page, select huidu.example.com, and click Manage in the operation column to enter the editing page. On the editing page, change the weight of EdgeOne to 30 and that of the origin domain name to 70, and click Save. The policy will take effect immediately and will be effective on the live network after the DNS cache expires. For verification, refer to Step 2: Start canary release - Verify the effect.
Step 4. Switch the traffic in full
Perform the following operations to increase the traffic migration ratio to 100% and fully switch the traffic to EdgeOne.
1. Edit the default policy, remove the origin domain name, and retain only EdgeOne. Click Save for the policy to take immediate effect. The policy will be fully effective once the DNS cache expires, resulting in 100% traffic switching to EdgeOne. The verification process is the same as in Step 2: Start canary switching and verify the effectiveness.
2. You can disable and delete the traffic scheduling policy later if the service remains stable after 100% canary switching. At this point, disabling or deleting the policy has no impact on the service, and the traffic is fully managed by EdgeOne.