---
title: Mirroring
weight: 56
---
:icons: font
:sectlinks:
:linkattrs:

This tutorial has shown several scenarios where Istio can route traffic to different versions in order to compare versions and evaluate which one works best.

The link:../tutorial/#03-traffic-shifting[Traffic Shifting, window="_blank"] step was focused on *travels* service adding a new *travels-v2* and *travels-v3* workloads
and the link:../tutorial/#04-tcp-traffic-shifting[TCP Traffic Shifting, window="_blank"] showed how this scenario can be used on TCP services like *mysqldb* service.

Mirroring (or shadowing) is a particular case of the Traffic Shifting scenario where the proxy sends a copy of live traffic to a mirrored service.

The mirrored traffic happens out of band of the primary request path. It allows for testing of alternate services, in production environments, with minimal risk.

Istio mirrored traffic is only supported for HTTP/gRPC protocols.

This step will show how to apply mirrored traffic into the *travels* service.

NOTE: *Step 1:* Use the Traffic Shifting Wizard on *travels* service

We will simulate the following:

- *travels-v1* is the original traffic and it will keep 80% of the traffic
- *travels-v2* is the new version to deploy, it's being evaluated and it will get 20% of the traffic to compare against *travels-v1*
- But *travels-v3* will be considered as a new, experimental version for testing outside of the regular request path. It will be defined as a mirrored workload on 50% of the original requests.

++++
<a class="image-popup-fit-height" href="/images/tutorial/05-07-mirrored-traffic.png" title="Mirrored Traffic">
    <img src="/images/tutorial/05-07-mirrored-traffic.png" style="display:block;margin: 0 auto;" />
</a>
++++

NOTE: *Step 2:* Examine Traffic Shifting distribution from the *travels-agency* Graph

Note that Istio doesn't report telemetry (or flag) mirrored traffic from source proxy.

Then in the Graph the *travels* edge to *travels-v3* workload should be marked as grey, meaning no traffic (note: the Show Idle Edges Display option must be enabled to see the grey edges).

++++
<a class="image-popup-fit-height" href="/images/tutorial/05-07-mirrored-graph.png" title="Mirrored Graph">
    <img src="/images/tutorial/05-07-mirrored-graph.png" style="display:block;margin: 0 auto;" />
</a>
++++

{nbsp} +
This can be examined better using the "Source" and "Destination" metrics from the "Inbound Metrics" tab.

The "Source" proxy, in this case the proxies injected into the workloads of *travel-portal* namespace, won't report telemetry for *travels-v3* mirrored workload.

++++
<a class="image-popup-fit-height" href="/images/tutorial/05-07-mirrored-source-metrics.png" title="Mirrored Source Metrics">
    <img src="/images/tutorial/05-07-mirrored-source-metrics.png" style="display:block;margin: 0 auto;" />
</a>
++++

{nbsp} +
But the "Destination" proxy, in this case the proxy injected in the *travels-v3* workload, will collect the telemetry from the mirrored traffic.

++++
<a class="image-popup-fit-height" href="/images/tutorial/05-07-mirrored-destination-metrics.png" title="Mirrored Destination Metrics">
    <img src="/images/tutorial/05-07-mirrored-destination-metrics.png" style="display:block;margin: 0 auto;" />
</a>
++++

{nbsp} +

NOTE: *Step 3:* Update or delete Istio Configuration

As part of this step you can update the Mirroring scenario to test different mirrored distributions. When finished you can delete the generated Istio config for the *travels* service.



