During application iterations, you can use end-to-end throttling to verify a new version on a small number of instances. After the verification succeeds, you can upgrade the applications on all instances to the new version.

Scenario

Web Application A V1 is deployed on two Elastic Compute Service (ECS) instances by using WAR packages. After Web Application A V2 is available, you must verify it on one instance. After the verification succeeds, upgrade Web Application A V1 on the other instance to V2.

Canary release process

  1. Create a canary instance group.
  2. In the canary instance group, configure and enable a throttling rule.
  3. Deploy V2 in the canary instance group and check whether the specified traffic is distributed to the instance in the canary instance group.
  4. Verify V2 based on the traffic that is distributed to the canary instance group.
  5. After the verification succeeds, upgrade the application on the instance in the default group to V2.

    If issues occur during the verification, disable the throttling rule for the canary instance group and move the instance from the canary instance group to the default group. After you troubleshoot the issues, enable the throttling rule for the canary instance group again. Then, deploy and verify V2 in the canary instance group.

  6. Disable the throttling rule for the canary instance group and delete the canary instance group.

Step 1: Create a canary instance group

In ECS clusters, different application versions are deployed based on instance groups, and throttling rules are configured based on instance groups. Therefore, you must create a canary instance group first.

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, click Applications. On the Applications page, select the namespace to which the application to upgrade belongs and click the name of the application.
  3. On the application details page, click the Instance Information tab. Then, click Create Group in the upper-right corner.
  4. In the Create Group dialog box, set Group Name to Canary Instance Group and click Create.
    After the group is created, the message The group is created. appears in the upper part of the page.

Step 2: Configure and enable a throttling rule

You can configure HSF and HTTP throttling rules.

  • To configure an HTTP throttling rule, click the Basic Information tab and enable Traffic Management.
  • To configure an HSF throttling rule, you do not need to enable Traffic Management. However, you must make sure that Enterprise Distributed Application Service (EDAS) Container 3.5.3 or later is used.

The following procedure describes how to configure an HTTP throttling rule:

  1. In the Application Settings section of the Basic Information tab, click Enable next to Traffic Management.
  2. On the Instance Information tab, click Traffic Adjustment in the upper-right corner of the Canary Instance Group section and select HTTP Traffic Adjustment.edas-AppDeploy-canary-singleApp-trafficControl.png
  3. In the Traffic Adjustment dialog box, configure the parameters and select Enable the following configuration to control HTTP request traffic that enters the current application instance group. Then, click Save.

    You can configure one of the following throttling rules for inbound traffic: Canary Release by Content and Canary Release by Ratio.

    • Canary Release by Content: distributes traffic that meets the configured rule to the canary instance group.
    • Canary Release by Ratio: distributes traffic to the canary instance group based on a specific proportion.

    The Canary Release by Ratio rule is easy to configure. The following sections describe how to configure the Canary Release by Content rule for inbound traffic.

    Traffic Adjustment

    Parameters required for a throttling rule:

    • Conditional Mode: Select Meet All Following Conditions.
    • Conditions: Valid values are Cookie, Header, and Parameter. In this example, Parameter is used.
      • Parameter Type: Select Parameter.
      • Parameter: Enter version.
      • Conditions: Select =.
      • Value: Enter 1.
    Notice After the parameters are configured, select Enable the following configuration to control HTTP request traffic that enters the current application instance group to make the throttling rule take effect.

    If the canary instance group has no instances to receive the canary traffic after the throttling rule takes effect, the default group is automatically used.

Step 3: Deploy and verify the new version

  1. Move an instance to the canary instance group.
    1. Open the Instance Information tab. In the Default Group section, find the instance that you want to move to the canary instance group and click Change Group in the Actions column.
    2. In the Change Group dialog box, select Canary Instance Group from the Target Group drop-down list and click OK.
    After the instance is moved to the canary instance group, the version of the application on this instance is V1.
  2. Deploy the new version.

    You can deploy the new version by using the console or tools. In this example, the new version is deployed in the console. For more information about how to deploy the new version by using other tools, see Overview.

    1. In the upper part of the application details page, click Deploy Application.
    2. On the Select Deployment Mode page, click Start Deployment next to Regular Release (Single-batch/Multi-batch).
      Note In this example, V1 is deployed by using a WAR package. Therefore, you must select the WAR package to deploy V2. If you have deployed the application by using a JAR package, configure the parameters for the JAR deployment method.
    3. Configure the parameters for application deployment.
      • Deployment Method: Select JAR.
      • File Uploading Method: Select Upload JAR Package and click Select File. In the dialog box that appears, select the local JAR package for V2.
      • Version: Enter V2.
      • Group: Select the canary instance group that you create.
      • Batches per Group: Select 1 Batches.
      • Batch Mode: Select Automatic.

      After the application is deployed, the Change Details page appears. You can view the deployment progress on this page. If the value of Change Status is Success, the deployment is successful. If the deployment fails, the related log appears on the Change Details page. You can check the log for troubleshooting. For more information, see How do I troubleshoot issues in a change process?.

      Open the application details page and click the Instance Information tab. On the Instance Information tab, the value of Package Version/MD5 is changed to V2, and the value of Running Status is changed to Normal in the canary instance group.

  3. Verify the throttling rule.
    1. In the browser address bar, enter http://<IP address of the instance in the default group>:<service port> and press Enter.
      The web page of Web Application V1 appears.
    2. In the browser address bar, enter http://<IP address of the instance in the default group>:<service port>? version=1 and press Enter.
      The web page of Web Application V2 appears.
    The results show that the throttling rule has taken effect, and the specified traffic is distributed to the instance in the canary instance group.

Step 4: Verify the new version

You can verify the new version based on your business requirements.

If issues occur during the verification, disable the throttling rule for the canary instance group and move the instance from the canary instance group to the default group. After you troubleshoot the issues, enable the throttling rule for the canary instance group again. Then, deploy and verify V2 in the canary instance group.

Step 5: Upgrade the application in the default group

After the verification succeeds, upgrade the application in the default group to V2.

To upgrade the application, you must deploy the application again. For more information about the procedure, see Step 3: Deploy and verify the new version.

Step 6: Disable the throttling rule and delete the canary instance group

After Web Application A V1 on the instances in both groups is upgraded to V2, you must disable the throttling rule and delete the canary instance group.

  1. On the Instance Information tab, click Traffic Adjustment in the upper-right corner of the Canary Instance Group section and select HTTP Traffic Adjustment.
  2. In the Traffic Adjustment dialog box, clear Enable the following configuration to control HTTP request traffic that enters the current application instance group and click Save.
  3. Open the Instance Information tab, find the instance in the canary instance group and click Change Group in the Actions column.
  4. In the Change Group dialog box, select Default Group from the Target Group drop-down list and click OK.
  5. Open the Instance Information tab, and click Delete Group in the upper-right corner of the Canary Instance Group section.