Traffic mirroring or shadowing is a feature that can be used to test new versions of a service with real traffic before rolling it out to the users with minimal risk or to monitor and audit traffic of existing services. Mirroring sends a copy of live traffic to a mirrored service.

Try it out! 🔗︎

Using the Backyards CLI 🔗︎

These examples work out of the box with the demo application packaged with Backyards. Change the service name and namespace to match your service.

First, we need to modify the existing routing rules on the movies service:

$ backyards routing route get backyards-demo/movies
Settings for backyards-demo/movies

Matches    Routes                Redirect  Timeout  Retry  Rewrite  Mirror To
port:8082  33% movies:8082 (v1)  -         -        -      -        -
           33% movies:8082 (v2)
           34% movies:8082 (v3)

$ backyards routing route set backyards-demo/movies -m port=8082 -d movies:8082:v1 -d movies:8082:v2 -w 50/50
INFO[0002] routing for backyards-demo/movies set successfully

Settings for backyards-demo/movies

Matches    Routes                Redirect  Timeout  Retry  Rewrite  Mirror To
port:8082  50% movies:8082 (v1)  -         -        -      -        -
           50% movies:8082 (v2)

We can now mimic a silent release of a new version of the movies service. Use the mirror set command to enable 50% traffic mirroring for the movies (v3) service:

$ backyards routing mirror set backyards-demo/movies -m port=8082 --host movies --subset v3 --port 8082 --mirror-percentage 50
? Destination host movies
? Destination subset v3
? Destination port 8082
? Mirror percentage 50
INFO[0004] mirror configuration for http route port:8082 of backyards-demo/movies set successfully 
Settings for backyards-demo/movies

Matches    Routes                Redirect  Timeout  Retry  Rewrite  Mirror To             
port:8082  50% movies:8082 (v1)  -         -        -      -        50% movies:8082 (v3)  
           50% movies:8082 (v2)

The percentage of the mirrored requests can be controlled with the --mirror-percentage flag.

Tip 1: all CLI commands and switches have short names, check the CLI docs to get to know them.

Using the Backyards UI 🔗︎

Mirroring can also be configured from the dashboard. Select the service on the Services or on the Topology view, and edit an existing or create a new rule on the traffic management tab:

Configure Traffic Management Configure Traffic Management