tencent cloud

Feedback

Scheduling Traffic to EdgeOne by Performing Canary Switching

Last updated: 2023-10-13 14:36:31
    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.
    
    
    

    Purpose

    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.

    Directions

    Step 1. Add an initial canary switching policy

    1. Log in to the EdgeOne console and click Site List in the left sidebar. In the site list, find the site example.com and click the site name.
    2. On the site management page, choose Domain Name Service > Traffic Scheduling in the left sidebar. On the Traffic Scheduling page, click Add scheduling policy.
    
    
    3. In the Select domain name step, select huidu.example.com from the Access domain name drop-down list and click Create.
    
    
    4. In the Add service provider step, specify a custom service provider name, such as origin domain name, and enter origin.example.com as the origin domain name. This is because the traffic is migrated from the origin in this example. Then, 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

    After you added the policy, EdgeOne assigns a CNAME record for traffic scheduling to the domain name. The assigned CNAME record is the same as the default CNAME record of the domain name. You need to configure the CNAME record at your DNS service provider to activate the traffic scheduling policy. For more information, see Step 4 in Connecting via CNAME.
    
    

    2. Verifying the switching result

    You can run the nslookup or dig command to check the switching result.
    Windows
    macOS or Linux
    Open the command prompt and run nslookup -qt=cname huidu.example.com. Then, check the ratio of the CNAME addresses in the DNS result.
    
    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.
    
    
    Open the terminal and run dig huidu.example.com. Then, check the ratio of the CNAME addresses in the DNS result.
    
    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. Viewing traffic changes

    Choose Data Analysis > Traffic Analysis in the left sidebar and filter the traffic by setting the filter to Host / Equal to / huidu.example.com. Then, view the changes of the traffic trend curves. For example, if the total bandwidth is 100 Mpbs and 1% of the traffic is switched to EdgeOne, the bandwidth curve will raise to 1 Mbps.
    
    
    

    Step 3. Increase the traffic migration ratio

    To increase the traffic migration ratio to 30%, go to the Traffic Scheduling page, find huidu.example.com, and click Manage in the Operation column. On the page that appears, change the weight of EdgeOne to 30 and that of the origin to 70, and click Save. The policy will take effect after the DNS cache expires. Then, verify the switching result. For more information, see 2. Verifying the switching result in Step 2.
    
    
    

    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. Delete the service provider origin domain name and click Save. The policy will take effect after the DNS cache expires. Then, verify the switching result. For more information, see 2. Verifying the switching result in Step 2.
    
    
    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.
    

    Relevant Documentation

    Scheduling Traffic to Multiple Service Providers
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support