Step 6: Shift application traffic

更新时间:
复制 MD 格式

This topic describes how to use LHC to shift application layer traffic. You will adjust and push sharding rules for the access and application layers to verify the accuracy of traffic and RPC routing.

Note

This tutorial is typically used for grayscale testing scenarios.

Prerequisites

  • The application layer sharding rules are configured as follows:

    • RZ01A: 00-49

    • RZ02A: 50-99

  • You need the following accounts:

    • Account A: The UID shard bit is 08, which belongs to the RZ01A shard.

    • Account B: The UID shard bit is 38, which belongs to the RZ01A shard.

Step 1: Adjust and push the sharding rules

  1. Log on to the LHC console.

  2. In the navigation pane on the left, click Traffic Management > Application Layer.

  3. Click Rule Configuration to go to the Production Traffic Rule Configuration page. This page displays the current rules.

  4. Click a logical unit card or shard data to open the edit page. Modify the UID shards for the deployment units as follows:

    • RZ01A: 00-29

    • RZ02A: 30-99

      Note

      After you adjust the sharding rules, the logical units for the accounts change as follows: Account A: 08 (belongs to the RZ01A shard). Account B: 38 (belongs to the RZ02A shard).

  5. After you make the changes, click Save.

  6. Click Push Traffic Rules to go to the Push Traffic Rules page.

  7. Set the following push configurations to push the latest rules to all units that are managed by middleware and Application Load Balancer (ALB).

    • Rule Details: The system automatically generates a JSON-formatted text string based on the current traffic rules. This text is used as a parameter when you push the rules to an application or a central service. This parameter informs global or specific applications about the traffic change.

    • Deployment Unit: Set this option to All Deployment Units.

    • Target Component: Set this option to Middleware and ALB Management. Typically, both components must be notified of traffic rule changes, except in some grayscale testing scenarios.

    • Target Application: Select the applications that need to be notified of the rule changes. You can push the rules to all applications globally. For grayscale or testing scenarios, you can also push the rules to specific applications to validate traffic against the new rules.

    • Overwrite Other Applications: This option is available when you push rules to global applications. Enable this option to overwrite the current rules for the applications with the new traffic rules. If this option is disabled, rules that were previously pushed to individual applications are retained.

  8. Click Push to apply the new traffic rules.

Step 2: Perform a transfer operation

Simulate a transfer from Account A to Account B.

Step 3: View the business trace

Use Distributed Tracing (DST) to view the traffic distribution. After you adjust the sharding rules, the transfer traffic from Account A to Account B changes from intra-unit to cross-unit.

Follow these steps:

  1. Log on to the Distributed Tracing console. In the navigation pane on the left, select Trace Search.

  2. On the Trace Search page, specify search conditions as needed and click Query. For example, in the Application Name field, enter the name of the application that initiated the transfer.

  3. In the list of traces, find the most recent trace and click its TraceId. View the trace details to verify that the traffic flow is now cross-unit.