This topic describes how to use the traffic mirroring feature of Application Load Balancer (ALB ) to simulate service traffic.

Scenarios

A growing number of enterprises have high requirements for security and stability of their online services. Before an enterprise officially releases a new feature, the feature must be tested. To ensure that online services are not interrupted, the test must run in a staging environment where service traffic is simulated.

ALB provides the traffic mirroring feature to simulate service traffic. The traffic mirroring feature can mirror online service traffic to backend servers that provide the staging environment. At the same time, ALB drops the responses from the backend servers to ensure that online services are not affected. You can use traffic mirroring in the following scenarios:
  • Test new features and service performance.
  • Simulate online service traffic without the need to create additional data.
  • Simulate online issues to troubleshoot errors.
Simulate service traffic

Prerequisites

Simulate online service traffic by using traffic mirroring

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region where the ALB instance is deployed.
  3. On the Instances page, click the ID of the ALB instance.
  4. On the Listener tab, find the listener and click View/Modify Forwarding Rule in the Actions column.
  5. Choose Forwarding Rules > Inbound Forwarding Rules, and click Add New Rule.
  6. In the Add Forwarding Rules section, set the parameters.

    In this example, traffic from the /test Path is mirrored to servers in Server Group B.

    Configure traffic mirroring
    Action: Set Traffic Mirror to Server Group B and Forward to Server Group A.
    Notice ALB drops the responses from Server Group A. Therefore, you must set Forward to Server Group A. This ensures that your online services are not affected.

    For more information about the parameters, see Manage forwarding rules for a listener.

  7. Click OK to mirror the specified traffic to Server Group B.