Blogs/Quality Assurance Testing

Shadow Testing a Beginners Guide

Written bySurya
Jul 31, 2026
14 Min Read
Shadow Testing a Beginners Guide Hero
Too Long? Read This First

- Shadow testing runs a new version of a system alongside the existing production version.
- Real requests are copied to both versions, but only the current production version is allowed to respond to users. The shadow version’s results are logged and compared against the production baseline.
- A safe implementation requires:
- Mirroring only approved traffic
- Preventing shadow requests from creating real side effects
- Protecting sensitive production data
- Correlating primary and shadow results
- Comparing correctness, latency, errors, and resource usage
- Monitoring the additional infrastructure load
- Defining clear success criteria before starting
- Shadow testing is not the same as a canary deployment, A/B test, or feature flag. Those techniques expose at least some users to the new behaviour; true shadow testing does not.

Staging environments are useful, but they rarely reproduce the exact traffic patterns, data variety, infrastructure behaviour, and dependency failures found in production. Shadow testing helps close this gap by allowing teams to evaluate a new system with real production requests, without returning its responses to users.

A stable production version continues serving customers. At the same time, selected requests are copied to a candidate version running in parallel. The candidate processes those requests, but its outputs are captured only for analysis. Users remain entirely on the proven production path.

This makes shadow testing particularly valuable when replacing an API, modernising a service, validating a machine-learning model, or making another high-risk change that is difficult to test realistically before deployment.

However, shadow testing is not automatically safe. Mirrored requests can duplicate database writes, trigger emails, expose personal information, and double infrastructure load unless the shadow environment is carefully isolated.

This guide explains how shadow testing works, when it is useful, how it differs from other deployment techniques, and how to implement it without affecting production users or data.

What Is Shadow Testing?

Shadow testing is a production-testing technique in which real traffic sent to an existing application or service is duplicated and delivered to a new version running in parallel.

The existing version remains the primary system. Its response is returned to the user as normal. The new or shadow version processes a copy of the same request, but its response is not returned to the user or allowed to control the production workflow.

The two outputs can then be compared to identify differences in:

  • Functional results
  • Response times
  • Error rates
  • Resource consumption
  • Dependency behaviour
  • Model predictions
  • Scalability under real demand

Istio describes traffic mirroring, also called shadowing, as sending a copy of live traffic to a mirrored service outside the critical request path of the primary service.

A simplified shadow-testing flow looks like this:

Shadow testing

The dotted path is important. The shadow request happens outside the user-facing response path. If the shadow system is slow or fails, the production response should remain unaffected.

How Shadow Testing Works

Suppose an online retailer is replacing its existing search service.

When a customer searches for “running shoes,” the request is sent to the current search service. That service returns the results the customer sees.

The same request is also copied to the replacement service. Its results are recorded but discarded instead of being displayed. The testing system can then compare both result sets.

The team might examine whether the new service:

  • Returned relevant products
  • Applied stock and regional filters correctly
  • Produced more or fewer errors
  • Responded within the required time
  • Consumed acceptable CPU and memory
  • Handled unusual search terms successfully

The team can begin by mirroring a small percentage of eligible requests and gradually increase the proportion as confidence grows. Throughout the test, the existing system remains responsible for user-facing responses.

Shadow Testing Is Not Restricted User Access

A common explanation describes shadow testing as making a feature available only to employees or a small group of users. That is usually an internal release, feature-flag rollout, beta release, or canary deployment.

In true traffic-shadowing:

  • Users remain on the primary version.
  • The shadow version receives duplicated requests.
  • Shadow responses are not shown to users.
  • Users do not knowingly interact with the new version.
  • The shadow system cannot determine the production outcome.

Some teams use “shadow release” or “dark launch” more broadly, so terminology varies. What matters is documenting whether the candidate system merely observes copied traffic or actually serves some users.

Shadow Testing vs. Other Release Strategies

Shadow testing, dark launches, canary deployments, blue-green deployments, feature flags, and A/B tests all reduce release risk, but they operate differently.

TechniqueWho receives the new result?Primary purposeUser impact
Shadow testingNo usersCompare a candidate against production using copied trafficNone intended
Canary deploymentA small percentage of usersValidate a release with limited real-user exposureSome users receive the new version
A/B testingAssigned user groupsCompare business or user-experience outcomesDifferent groups see different experiences
Blue-green deploymentUsers are switched from one environment to anotherReduce cutover risk and enable quick rollbackUsers eventually move to the new environment
Feature flagSelected users or conditionsControl whether functionality is visible or activeDepends on flag configuration
Beta releaseInvited external usersCollect usability and product feedbackBeta users knowingly use the new version
Staging testingTesters or simulated trafficValidate before production deploymentNo production-user involvement
Shadow testing
Who receives the new result?
No users
Primary purpose
Compare a candidate against production using copied traffic
User impact
None intended
1 of 7

A canary deployment deliberately exposes a small portion of production users to the candidate version. Shadow testing duplicates their requests but continues returning the established version’s response. Google’s description of canary analysis follows this same distinction.

A/B testing is even further removed from shadow testing. Its purpose is usually to compare user behaviour, such as conversions or engagement. Since shadow output is invisible, it cannot directly measure how users respond to the new experience.

Why Is Shadow Testing Useful?

It validates real production behaviour

Synthetic performance tests approximate production traffic. Shadow testing uses actual request shapes, frequencies, combinations, and timing.

This can reveal problems caused by rare payloads, traffic bursts, geographic differences, unusual account configurations, or dependency behaviour that test environments failed to reproduce.

It avoids serving unproven responses

The candidate system processes real requests, but the established production version remains in control. This gives teams production-level evidence without deliberately directing users to an unproven implementation.

It supports output comparison

Because both versions receive equivalent input, teams can compare their results under closely matched conditions.

This is especially valuable when replacing a service expected to preserve existing behaviour. Differences can be investigated before traffic is switched.

It exposes scalability problems

A candidate may pass functional and load tests yet behave differently under real concurrency, caching patterns, data distributions, or dependency latency.

Shadow traffic reveals whether it can sustain realistic demand and what infrastructure it would require.

It supports safer migrations

Shadow testing works well when migrating between application versions, databases, search engines, recommendation systems, payment-routing logic, APIs, or machine-learning models.

It allows the old and new systems to be evaluated in parallel before the old one is retired.

When Should You Use Shadow Testing?

Shadow testing provides the greatest value when uncertainty remains even after comprehensive pre-production testing.

Good candidates include:

Service rewrites and platform migrations

If a team rewrites an existing service in another language or moves it to a new platform, shadow testing can verify compatibility using the requests the current service already receives.

API version upgrades

Mirrored requests can reveal whether a new API version handles production payloads, headers, authentication contexts, and edge cases correctly.

Sensitive credentials may need to be removed, replaced, or scoped before requests are replayed.

Search and recommendation systems

Search and recommendation outputs can be difficult to assess with simple pass-or-fail assertions. Shadow results can be compared using relevance, ranking, coverage, latency, and business-specific quality measures.

Machine-learning and AI models

A new model can process the same live inputs as the current model while its predictions remain invisible. Teams can compare accuracy proxies, safety results, latency, cost, and output drift before serving the new model.

AWS describes shadow tests similarly: new versions run in parallel on mirrored production traffic, while their responses are compared without being served to users.

High-traffic systems

A service that performs well at moderate load may behave differently during real traffic peaks. A controlled shadow percentage helps teams evaluate capacity before cutting over.

High-risk business logic

Pricing, fraud detection, entitlement, or routing changes may benefit from parallel evaluation, provided the shadow system cannot execute real transactions or alter production decisions.

Sleep Easy Before Launch

We'll stress-test your app so users don't have to.

When Shadow Testing Is Not the Right Choice

Shadow testing adds infrastructure, observability, data-protection, and comparison overhead. It may be unnecessary for a small, low-risk UI change that can be validated adequately through conventional testing.

It is also a poor fit when requests cannot be copied safely. For example, replaying a payment command or password-reset request could trigger harmful side effects unless the shadow environment intercepts every external action.

Shadow testing may provide limited value when outputs are highly non-deterministic and the team has no meaningful comparison method. It can still be used, but success criteria must evaluate acceptable behaviour rather than exact equality.

Finally, it cannot measure genuine user reaction. If the question is whether customers prefer a new checkout design, an A/B test or controlled beta is more appropriate.

The Biggest Risk: Duplicate Side Effects

The most serious shadow-testing mistake is duplicating a production request without controlling what the second execution can do.

A mirrored GET request may appear harmless, although it can still update caches, sessions, analytics, or access timestamps. A mirrored POST, PUT, PATCH, or DELETE request presents a clearer risk.

Without protection, a shadow request could:

  • Charge a customer twice
  • Create a duplicate order
  • Send another email or text message
  • Reserve inventory
  • Modify an account
  • Publish an event
  • Trigger a third-party webhook
  • Write conflicting information into a database

A shadow environment should therefore be designed as an observation path, not simply a second production instance.

Common protections include redirecting writes to an isolated database, replacing external services with controlled substitutes, suppressing outbound events, using transaction rollbacks, or converting unsafe operations into dry runs.

Every dependency must be reviewed. Preventing database writes is insufficient if the shadow system can still call a payment provider or email service.

Protecting Production Data

Shadow testing frequently involves production requests, which may contain personal, financial, confidential, or authentication data.

Before mirroring traffic, teams should determine:

  • Which fields the candidate genuinely needs
  • Whether sensitive fields can be masked or tokenised
  • Where shadow requests and outputs will be stored
  • Who can access the resulting logs
  • How long the data will be retained
  • Whether data can cross accounts, regions, or legal boundaries
  • Whether consent or regulatory restrictions apply

Avoid copying complete request bodies when the test requires only a few fields. Authentication tokens and session credentials should not be replayed into an environment where they could be exposed or misused.

Logging also requires care. A team may protect the mirrored request while accidentally storing its complete payload in a comparison log.

How to Perform Shadow Testing

1. Define the decision the test must support

Begin with a specific question.

“Test the new service in production” is too broad. Better goals include:

Determine whether API v2 produces functionally equivalent responses to API v1 while maintaining a p95 latency below 250 milliseconds.

Or:

Verify that the new recommendation model improves offline relevance measures without increasing inference cost by more than 15%.

This determines which traffic to mirror, which metrics to collect, and when the test can end.

2. Establish a trusted production baseline

Measure the primary system before introducing the shadow version.

The baseline may include latency percentiles, error rates, throughput, resource usage, output distribution, timeout frequency, and business-specific correctness measures.

Without a baseline, the team may observe that the shadow system has a 1% error rate but not know whether that is better or worse than production.

3. Decide which traffic is safe to mirror

Do not begin by copying all production traffic.

Define eligible endpoints, operations, user segments, geographic regions, or request types. Exclude requests involving dangerous side effects, unsupported payloads, highly sensitive data, or unusually large bodies until safeguards have been verified.

Sampling should be representative. Mirroring only easy requests can make the candidate appear safer than it is.

4. Prepare the shadow environment

The candidate should run with production-like configuration and dependencies wherever practical. At the same time, it must be isolated from production writes and user-facing actions.

Capacity should be planned explicitly. Mirroring 100% of traffic can nearly double application processing for the affected service, along with additional logging, network, database, and observability costs.

5. Configure traffic mirroring

Traffic can be duplicated at an API gateway, reverse proxy, load balancer, service mesh, message broker, or application layer.

Platforms such as Istio and Envoy support request-mirroring policies. Envoy’s documentation describes shadow requests as “fire and forget,” meaning the proxy does not wait for the shadow response before completing the primary request.

Application-level duplication offers more control over sanitisation and filtering, but it also places custom logic inside the application and may increase maintenance complexity.

6. Correlate both executions

Attach a correlation identifier to the primary and shadow request. This allows the corresponding results, traces, logs, and metrics to be matched later.

The identifier should support debugging without exposing customer information. It must also remain unique across retries and concurrent requests.

7. Normalise results before comparison

Exact response comparison often produces false differences.

Two functionally equivalent responses may contain different:

  • Timestamps
  • Request identifiers
  • Ordering
  • Generated database IDs
  • Trace values
  • Floating-point precision
  • Metadata
  • Non-deterministic recommendations

Create a normalisation layer that removes or standardises expected differences before comparing outputs.

For JSON responses, the comparison might ignoregenerated_at, sort unordered collections, normalise numeric precision, and map equivalent status representations.

8. Compare functional and operational behaviour

Correctness alone is insufficient. A shadow version might return the right result while consuming three times more memory or creating excessive dependency traffic.

Monitor both result quality and operational performance.

Comparison areaExample measures
CorrectnessExact match, field-level match or business-rule agreement
ReliabilityError rate, timeout rate and failed dependencies
Performancep50, p95 and p99 latency
CapacityCPU, memory, network and connection usage
Data behaviourReads, attempted writes and cache efficiency
Business logicPrice, eligibility, ranking or decision agreement
CostCompute, storage, API and model-inference expense
SecurityAuthentication failures, sensitive-data handling and policy violations
Correctness
Example measures
Exact match, field-level match or business-rule agreement
1 of 8

9. Increase traffic gradually

A sensible progression might begin with internal or synthetic requests, followed by 1% of safe production traffic, then 5%, 25%, and a larger representative sample.

The exact percentages depend on risk and volume. A high-traffic service may collect sufficient evidence at a very small percentage.

Expansion should be based on results, not a fixed calendar.

10. Stop, correct, or progress

Define the action associated with each threshold before the test begins.

For example:

  • Stop mirroring if primary latency increases.
  • Reduce traffic if shadow resources approach capacity.
  • Investigate if output disagreement exceeds the accepted threshold.
  • Progress to canary exposure only after correctness and reliability criteria pass.

Once shadow testing establishes that the candidate behaves safely, the next step may be a canary deployment. At that point, a small percentage of users actually begin receiving the candidate’s responses.

How Do You Compare Primary and Shadow Outputs?

Output comparison is one of the hardest parts of shadow testing.

Deterministic systems

For a deterministic API, teams may expect exact agreement after removing fields such as timestamps and trace IDs.

Any remaining difference can be classified by field, operation, customer type, or request pattern to locate systematic errors.

Search and recommendation systems

Two result lists can both be acceptable without being identical. Comparisons may use result overlap, ranking similarity, availability, diversity, click-history relevance, or human evaluation.

Because users never see the shadow result, engagement cannot be measured directly during this stage.

Machine-learning and AI systems

AI outputs may vary even when the same request is repeated. Exact string comparison is rarely sufficient.

Teams can evaluate task completion, factual consistency, safety, format adherence, latency, token usage, inference cost, or agreement with a human-reviewed dataset.

Stateful systems

Results may differ because the primary and shadow versions do not share identical state. The team must decide whether to replicate state, take consistent snapshots, or compare only behaviour that remains meaningful under controlled state differences.

Role of QA in Shadow Testing

Shadow testing is not solely an infrastructure activity. Testers help define what equivalence means and whether a difference is acceptable.

QA responsibilities may include:

Defining comparison rules

Testers identify fields that must match, fields that may differ, and business rules that should be evaluated independently.

Sleep Easy Before Launch

We'll stress-test your app so users don't have to.

Designing high-risk traffic categories

Production traffic provides realism, but it does not guarantee coverage. Testers identify rare or critical scenarios and confirm whether they appear in the mirrored sample.

Investigating mismatches

A comparison dashboard may show a 4% disagreement rate. Testers determine whether those mismatches are defects, expected design changes, data timing differences, or comparison errors.

Validating isolation

QA should verify that shadow execution cannot alter production data or trigger external actions. This includes deliberately testing endpoints with side effects.

Supporting rollout decisions

Testing results should translate into a clear recommendation: continue shadowing, increase traffic, correct the candidate, or progress to limited user exposure.

Monitoring a Shadow Test

Monitoring should protect both the primary service and the shadow environment.

The primary service remains the first priority. If traffic mirroring increases its latency, connection usage, or failure rate, the test is no longer risk-free and should be reduced or stopped.

The shadow environment should be monitored for:

  • Request and response volume
  • Success and error rates
  • Latency percentiles
  • Timeouts
  • CPU and memory utilisation
  • Queue depth
  • Dependency failures
  • Comparison mismatches
  • Attempted side effects
  • Logging volume and cost

Distributed tracing can be particularly useful because it shows where primary and shadow execution paths diverge across dependencies.

Tools Used for Shadow Testing

Shadow testing normally requires several categories of tooling rather than one dedicated product.

Tool categoryPurposeExamples
Service mesh or proxyDuplicate selected requestsIstio, Envoy
API gateway or load balancerRoute and sample trafficPlatform-dependent gateways and proxies
ObservabilityMeasure latency, errors and resourcesPrometheus, Grafana, Datadog, New Relic
LoggingCapture outcomes and mismatchesElasticsearch, OpenSearch, Splunk
Distributed tracingCompare request pathsOpenTelemetry, Jaeger
Feature managementControl rollout after shadow validationLaunchDarkly and similar platforms
Data comparisonNormalise and compare outputsCustom comparison services or test frameworks
Service mesh or proxy
Purpose
Duplicate selected requests
Examples
Istio, Envoy
1 of 7

Feature flags can support the broader release process, but a flag does not automatically duplicate traffic. Traffic mirroring still requires routing or application logic.

Common Shadow-Testing Mistakes

Treating shadow traffic as inherently safe

Users may not see the shadow response, but the candidate can still consume resources, access sensitive information, and create side effects. Safety must be engineered.

Comparing raw responses directly

Expected differences such as timestamps and generated IDs can flood the team with false failures. Normalise outputs before evaluating mismatches.

Mirroring only successful or simple traffic

This produces an unrealistic picture of candidate reliability. Include representative errors, unusual payloads, large requests, and less common workflows where safe.

Ignoring capacity and cost

A full mirror can duplicate compute, dependency, network, logging, and model-inference costs. Estimate the impact before increasing traffic.

Using shadow testing instead of pre-production testing

Shadow testing should follow unit, integration, regression, security, and performance testing. It is not an excuse to deploy an untested candidate alongside production.

Leaving the shadow deployment running indefinitely

Every shadow test should have an owner, success criteria, review date, and removal plan. Forgotten shadow infrastructure creates cost, security, and maintenance risks.

Shadow-Testing Best Practices

Start with read-only or easily isolated requests. These allow the team to verify routing, observability, and comparison logic before handling operations with greater risk.

Mirror a representative sample instead of automatically copying everything. Use deliberate sampling across endpoints, tenants, payload sizes, regions, and traffic periods.

Protect the primary request path. Shadow processing should be asynchronous or out of band so a slow candidate cannot delay the production response.

Create structured mismatch reports rather than relying only on raw logs. Classify discrepancies by type, severity, endpoint, and frequency so teams can identify patterns.

Finally, rehearse shutdown controls. The team should be able to stop mirroring quickly without redeploying the primary application.

Frequently Asked Questions

What is shadow testing in simple terms?

Shadow testing sends a copy of real production requests to a new system while the existing system continues responding to users. The new system’s results are analysed but not shown to customers.

Is shadow testing the same as a dark launch?

The terms sometimes overlap. In its traffic-mirroring meaning, a dark launch also sends copied production traffic to a hidden candidate and discards its results before they reach users. Terminology varies between teams.

What is the difference between shadow testing and canary testing?

Shadow testing does not return candidate responses to users. Canary testing directs a small percentage of users to the candidate version, meaning real customers experience and depend on its behaviour.

Can shadow testing affect production?

Yes. Traffic duplication can increase network, compute, database, and logging load. A badly isolated candidate can also create duplicate side effects, so production impact must be monitored continuously.

Can shadow testing be used for database migrations?

Yes, but write behaviour requires careful control. Teams may compare reads, dual-write into isolated targets, or validate transformed data while preventing the shadow path from modifying authoritative production records.

How much traffic should be mirrored?

Begin with a small, safe, representative sample. Increase it only after confirming that the primary service remains unaffected, the shadow environment has capacity, and comparison results meet defined thresholds.

Do users know shadow testing is happening?

Users do not interact with or see shadow responses. However, production-data processing may still create privacy, security, or compliance obligations that the organisation must assess before mirroring traffic.

What happens after a shadow test succeeds?

The candidate may progress to a canary, beta, or gradual rollout where selected users begin receiving its responses. Monitoring continues while exposure increases and the existing version remains available for rollback.

When should shadow testing be avoided?

Avoid it when requests cannot be copied safely, the candidate cannot be isolated from real side effects, data use would violate policy, or the expected benefit does not justify the infrastructure and operational complexity.

Conclusion

Shadow testing allows teams to evaluate a candidate system using the complexity of real production traffic without making that candidate responsible for user-facing results.

Its value comes from parallel comparison. The primary version establishes the trusted baseline, while the shadow version reveals how a proposed change behaves under the same requests, dependencies, traffic patterns, and operational conditions.

But hidden does not automatically mean harmless. A responsible shadow-testing strategy must isolate writes, suppress external side effects, protect sensitive data, control infrastructure load, normalise responses, and define measurable acceptance criteria.

Shadow testing also occupies a specific place in a wider release strategy. It follows comprehensive pre-production testing and often precedes a canary rollout. Used this way, it helps teams move from “the new version passed staging” to “the new version has demonstrated acceptable behaviour under production conditions.”

Author-Surya
Surya

I'm a Software Tester with 5.5 years of experience, specializing in comprehensive testing strategies and quality assurance. I excel in defect prevention and ensuring reliable software delivery.

Share this article

Phone

Next for you

10 Best AI Tools for QA Testing in 2026 Cover

Quality Assurance Testing

Jul 31, 202616 min read

10 Best AI Tools for QA Testing in 2026

Too Long? Read This First - Katalon is the strongest all-round option for teams wanting web, mobile, API, and desktop testing within one platform. - mabl suits cloud-native teams that want low-code functional and API testing with AI-assisted authoring, maintenance and analysis. - testRigor is best for writing end-to-end tests in plain English without maintaining conventional selectors. - Testsigma offers broad no-code coverage across web, mobile, API, desktop, Salesforce and SAP. - Testim combi

Top 12 Regression Testing Tools for 2026 Cover

Quality Assurance Testing

Jul 31, 202614 min read

Top 12 Regression Testing Tools for 2026

Too Long? Read This First - Playwright is our leading code-first choice for modern web applications because it combines cross-browser automation, parallel execution, tracing and strong debugging in one open-source framework. - Cypress is well suited to frontend teams that value an interactive developer experience, component testing and managed test analytics. - Selenium remains the most flexible language-agnostic option for teams with mature WebDriver expertise or large existing suites. - Katal

Web Application Testing Checklist for Beginners Cover

Quality Assurance Testing

Jul 31, 202614 min read

Web Application Testing Checklist for Beginners

Too Long? Read This First If you are testing a web application for the first time, follow this order: - Define the features, user roles, supported browsers, and test environment. - Test the most important journeys end to end, such as sign-up, login, search, checkout, or form submission. - Repeat each journey with valid, invalid, empty, duplicate, minimum, and maximum inputs. - Check mobile layouts, keyboard access, slow connections, expired sessions, and failed integrations. - Retest fixed defe