Configure a traffic replication policy

更新时间:
复制 MD 格式

Cloud-native API Gateway lets you replicate live route traffic to a designated service for simulation testing and troubleshooting.

Background information

Simulating real traffic in a test environment is difficult. Traffic replication solves this by copying live requests at the gateway ingress and forwarding them to a test service, enabling you to validate new features or reproduce defects with real production traffic.

Example scenario

In this example, Route1 replicates 100% of its traffic to Service2. The following figure shows the architecture:

image

Configure a traffic replication policy

  1. You can configure a traffic replication policy from either of the following entry points:

    API outside an instance

    1. Log on to the Cloud-native API Gateway console. In the navigation pane on the left, click API. In the top navigation bar, select a region.

    2. Click the target API name. From the instance drop-down list, select the target instance or select All instances. Click the HTTP API tab.

    3. In the Routes, click the target route.

    API inside an instance

    1. Log on to the Cloud-native API Gateway console. In the navigation pane on the left, click Instances. In the top navigation bar, select a region.

    2. On the Instances page, click the target gateway instance ID. In the left-side navigation pane, click API, then click the target API.

    3. In the Route List, click the target route.

  2. Click the Configure Policy tab. Then, in the Inbound Processing section, click Add Policy/Plugin.

  3. Click the Mirror Traffic card. In the Add Policy: Mirror Traffic panel, configure the parameters and click Add.

    Parameter

    Description

    Enable

    Enables or disables the traffic replication policy.

    Destination Service

    Destination service that receives replicated traffic.

    Note

    Only HTTP/HTTPS services are supported.

    Port

    Port of the destination service. Select Dynamic Port if service ports change dynamically.

    Note

    Dynamic Port is not available for multi-port services.

    Traffic Mirror Percentage

    Percentage of traffic to replicate. Valid values: 0 to 100.

    Note

    For example, a value of 50 replicates 50% of route traffic to the destination service.

Verify the result

Go to the Observation and Analysis > Business Monitoring > Canary Release Comparison Dashboard page of the gateway instance. Select Service1 and Service2 to compare QPS data. Identical QPS trends confirm that traffic was successfully replicated.