Configure a traffic replication policy

Updated at:

Cloud-native API Gateway can replicate live route traffic to a designated service, enabling simulation testing and troubleshooting with real production requests.

Background information

Simulating real traffic in a test environment is difficult. Traffic replication addresses this by copying live requests at the gateway ingress and forwarding them to a test service, letting you 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 traffic replication for this route.

    Destination Service

    The destination service that receives replicated traffic.

    Note

    Only HTTP/HTTPS services are supported.

    Port

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

    Note

    Dynamic Port is unavailable for multi-port services.

    Traffic Mirror Percentage

    The 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.