Traffic mirroring duplicates a percentage of live requests from a route on your cloud-native gateway and sends the copies to a secondary service for testing or analysis. This makes traffic mirroring a low-risk way to validate new service versions, reproduce bugs, or load-test with real production traffic.
How traffic mirroring works
When you enable traffic mirroring on a route, the gateway duplicates each incoming request at the ingress and forwards the copy to a destination service you specify. The primary request continues through the original route unaffected.
In this example, Route1 mirrors 100% of its traffic to Service2. Service1 continues to handle the original requests while Service2 receives identical copies for testing or analysis.
Key behaviors:
Percentage-based: You control the percentage of traffic to mirror (0--100%).
Limits
Only HTTP and HTTPS services are supported as mirror destinations.
Dynamic Port cannot be used for multi-port services.
Configure a traffic mirroring policy for a route
Before you begin, make sure that you have:
A cloud-native gateway with at least one route configured
A destination service for mirrored traffic associated with the gateway
To configure a traffic mirroring policy:
-
Log on to the MSE console. In the top navigation bar, select a region.
-
In the left-side navigation pane, choose Cloud-native Gateway > Gateways. On the Gateways page, click the ID of the gateway.
-
In the left-side navigation pane, click Routes. Then, click the Routes tab.
Find the target route and click Policies in the Actions column.
On the Policies tab, click Traffic Mirror.
Configure the following parameters and click Determine.
Parameter Description Destination Service The service that receives mirrored traffic. Only HTTP- or HTTPS-based services are supported. Port Number The port on the destination service. Select Dynamic Port if the service port changes dynamically. Dynamic Port is not available for multi-port services. Traffic Mirror Percentage (%) The percentage of traffic to mirror. Valid values: 0 to 100. For example, a value of 50 mirrors half of the route's traffic to the destination service. Enable Turn the traffic mirroring policy on or off.
Verify traffic mirroring
After you enable a traffic mirroring policy, verify that mirrored traffic reaches the destination service:
Open the gateway's Overview page.
Choose Observation Analysis > Business Monitoring > Canary Release Comparison Dashboard.
Compare the queries per second (QPS) of Service1 and Service2. With the mirror percentage set to 100%, the QPS of Service1 is the same as the QPS of Service2. This confirms that all traffic from the primary route is being mirrored to the destination service.