Quick answer
Shadow testing runs a new version of a service alongside the live one and sends it copies of real production requests, but its responses are never shown to users. Teams compare outputs, errors and latency at zero user exposure; it cannot measure how users react to the change.
What is shadow testing?
Shadow testing runs a new version of a service alongside the live one and sends it a copy of real production requests, but never shows its responses to users. The live version keeps answering every request; the shadow version's answers are discarded or logged, then compared with the live answers for differences, errors and latency. It is also called shadow deployment, traffic mirroring, traffic shadowing or, in a broader sense, a dark launch.
The point is to test with real inputs at zero user exposure. A shadow version sees the real mix of request shapes, frequencies and edge cases that a staging test never reproduces, yet if it crashes or returns nonsense, no user notices. The trade-off is just as important: because no user sees the shadow output, shadow testing cannot tell you how people react to the change. It answers "does the new version behave the same and hold up?", not "is the new version better for users?".
How traffic mirroring works
A typical setup has four parts:
- A mirror at the edge or in the service mesh. A proxy duplicates incoming requests, all of them or a sampled percentage, and sends the copy to the shadow version. In the Istio service mesh, for example, mirroring is set per route, an optional
mirrorPercentagesamples a share of traffic, and the mirrored request's Host header gets a-shadowsuffix so it can be told apart. - Fire and forget. The live response goes back to the user immediately. Istio's documentation describes mirrored requests as "fire and forget": their responses are discarded and do not slow the main request path.
- Response capture. To compare outputs, both versions log their responses (or a hash of them) with a shared request ID.
- A diff and a report. A comparison job matches live and shadow responses by request ID and reports mismatches, error rates and latency percentiles.
The same pattern is used for machine-learning models. In one cloud ML platform's shadow tests, a copy of each inference request goes to a shadow variant, and only the production variant's response is returned to the calling application. Martin Fowler's description of dark launching (2020) adds the load-test angle: running new back-end behavior for existing users without their noticing, to see its effect on load and performance before release.
What to compare between the live and shadow versions
| Signal | How to compute it | Example acceptance rule |
|---|---|---|
| Response mismatch rate | Mismatched responses ÷ mirrored requests, after ignoring fields expected to differ (timestamps, request IDs) | Unexplained mismatches below 0.05% |
| Error rate | 5xx responses ÷ mirrored requests, per version | Shadow not higher than live by more than 0.02 points |
| Latency | p50, p95 and p99 per version on the same requests | p99 within 10% of live |
| Resource use | CPU, memory, connections at the same request rate | Fits in the planned capacity |
| Side effects | Writes, emails, payments, calls to third parties | Zero: shadow must not cause any |
Decide the thresholds before the test starts. A mismatch rate means nothing until you know which differences are expected.
Worked example: a week of mirrored traffic
Sample data: an API serves 2,000,000 requests a day. The team rewrites its pricing service and mirrors 10% of traffic to the new version for 7 days: 200,000 mirrored requests a day, 1,400,000 in total.
- Mismatches. After ignoring timestamps and request IDs, 0.35% of responses differ: 700 a day, 4,900 over the week. Sorted by cause: 3,640 (74.3%) are a change in the order of items in a list, 1,050 (21.4%) are rounding differences in the third decimal place, and 210 (4.3%) are wrong prices for orders that combine a coupon with a bundle.
- Errors. Live returns 5xx on 0.08% of mirrored requests (1,120); shadow on 0.11% (1,540).
- Latency. p50 rises from 42 ms to 45 ms; p99 from 180 ms to 240 ms (+33%).
Decision against the rules above: the list-order and rounding mismatches are fixed by normalizing the comparison, but the 210 coupon-plus-bundle errors (0.015% of mirrored requests) are real bugs, the error rate exceeds the +0.02-point rule, and p99 breaks the 10% limit. The new version does not go to a canary yet. After fixes, the team mirrors again; only when the shadow run is clean does it move to a canary release where real users see it.
Note what the week could not show: whether customers buy more or less at the new prices. No customer saw them.
Shadow testing vs canary, A/B and smoke tests
| Shadow test | Canary release | A/B test | Smoke test | |
|---|---|---|---|---|
| Users exposed to the new version | None (0%) | A small share, for example 1–5% | A planned split, often 50/50 | None; runs on a build or environment |
| Traffic | Copy of real production requests | Real requests, real responses | Real requests, real responses | Scripted checks |
| What it measures | Output differences, errors, latency, load | Errors and key service metrics vs a control group | User behavior: conversion, engagement, revenue | Whether the basic functions start and respond |
| Can it measure user reaction? | No | Partly (errors users hit) | Yes, that is its purpose | No |
| Main risk | Side effects from duplicated writes; extra cost | A small share of users hit bugs | Users in the worse arm get a worse experience | Misses anything beyond the basics |
| Question it answers | Does the new version behave like the old one under real load? | Is it safe to roll out further? | Is the new version better for users? | Is the build broken? |
Google's SRE workbook defines canarying as "a partial and time-limited deployment of a change in a service and its evaluation", with the canary compared against a control population. Shadow testing usually comes before it: first prove the new version behaves, then let a few real users see it. Smoke testing comes before both, and progressive delivery is the umbrella for moving a change through these stages.
Risks and limits of shadow testing
- Duplicated side effects. A mirrored "place order" request must not charge a card, send an email or write to the shared production database. Stub or sandbox every write and every call to a third party, or mirror only read requests.
- Extra cost and load. Mirroring 100% of traffic roughly doubles the compute for that service and adds load to whatever the shadow calls. Sample a percentage, as in the example.
- Stateful divergence. If the shadow keeps its own state, its answers drift from the live version's over time for reasons that are not bugs. Compare on stateless endpoints, or reset the shadow state regularly.
- Personal data in logs. Logging full responses from both versions creates a second copy of production data. Log hashes or redacted fields where you can.
- No user signal. Conversion, engagement and satisfaction cannot be measured, because no user sees the output.
Where TapCub fits
TapCub does not mirror traffic, compare responses or split users between versions; it measures what real visitors experience. Mirrored requests are server-to-server and never reach a browser, so the shadow phase does not show up in TapCub at all. TapCub becomes useful at the next step, when the pricing service from the example moves to a canary and then to everyone:
- Mark the change. Add the canary start and the full rollout as dates in Configuration › Annotations, so every trend chart shows the dashed line where the change happened.
- Watch errors real users hit. Monitoring › Errors shows error count, error rate (errors ÷ pageviews), affected visitors and sessions, with each error group's count, sessions involved and last time seen, so a new client-side error after rollout stands out.
- Watch real-user performance. Monitoring › Performance reports Core Web Vitals from real browsers; a slower API usually shows up there as slower pages.
- Alert instead of staring. In All-platform analytics › Operations › Monitors, set a check on
error_rateby the hour; a dry run computes how many times it would have fired over the past 30 days, so you can tune the threshold before turning on notifications. Monitors only notify; they do not roll anything back.
Sources
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Data Analyst
Explores traffic sources, conversion funnels, and retention, using clear metric definitions and concrete examples to explain what the numbers mean.