TapCub is live — analytics, insights and live chat, free on one platform
Glossary

What is shadow testing? Traffic mirroring vs canary and A/B tests

Shadow testing sends a copy of real production requests to a new version whose responses are never shown to users. How mirroring works, what to compare, a one-week example, and how it differs from canary, A/B and smoke tests.

Su He Reviewed by Ethan Brooks Also called shadow deployment Last updated Nov 29, 2026 Glossary

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:

  1. 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 mirrorPercentage samples a share of traffic, and the mirrored request's Host header gets a -shadow suffix so it can be told apart.
  2. 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.
  3. Response capture. To compare outputs, both versions log their responses (or a hash of them) with a shared request ID.
  4. 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

SignalHow to compute itExample acceptance rule
Response mismatch rateMismatched responses ÷ mirrored requests, after ignoring fields expected to differ (timestamps, request IDs)Unexplained mismatches below 0.05%
Error rate5xx responses ÷ mirrored requests, per versionShadow not higher than live by more than 0.02 points
Latencyp50, p95 and p99 per version on the same requestsp99 within 10% of live
Resource useCPU, memory, connections at the same request rateFits in the planned capacity
Side effectsWrites, emails, payments, calls to third partiesZero: 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 testCanary releaseA/B testSmoke test
Users exposed to the new versionNone (0%)A small share, for example 1–5%A planned split, often 50/50None; runs on a build or environment
TrafficCopy of real production requestsReal requests, real responsesReal requests, real responsesScripted checks
What it measuresOutput differences, errors, latency, loadErrors and key service metrics vs a control groupUser behavior: conversion, engagement, revenueWhether the basic functions start and respond
Can it measure user reaction?NoPartly (errors users hit)Yes, that is its purposeNo
Main riskSide effects from duplicated writes; extra costA small share of users hit bugsUsers in the worse arm get a worse experienceMisses anything beyond the basics
Question it answersDoes 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:

  1. 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.
  2. 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.
  3. Watch real-user performance. Monitoring › Performance reports Core Web Vitals from real browsers; a slower API usually shows up there as slower pages.
  4. Alert instead of staring. In All-platform analytics › Operations › Monitors, set a check on error_rate by 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.

Su He

Data Analyst

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

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What is the difference between shadow testing and canary testing?

In shadow testing no user sees the new version: it receives copies of real requests and its responses are discarded or logged for comparison. In a canary release a small share of real users is served by the new version, so you can see errors they hit but they are exposed to its bugs.

Is shadow testing the same as A/B testing?

No. An A/B test splits real users between versions to measure behavior such as conversion. Shadow testing shows the new version to nobody, so it can compare outputs, errors and latency but cannot measure any user reaction.

What are the risks of shadow testing?

Duplicated side effects (a mirrored order that charges a card or sends an email), extra compute and downstream load, shadow state drifting from production, and a second copy of personal data in logs. Stub writes, sample traffic and log hashes where possible.

How much traffic should you mirror in a shadow test?

Enough to see rare request types, not so much that cost and downstream load double. Sampling 5 to 20% for a week often covers weekly cycles; in this page’s example 10% of 2 million daily requests gave 1.4 million comparisons.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics