How do you run shadow traffic and dark launches?

Shadow traffic and dark launches let you test real features under real load without exposing real users to risk. Shadow traffic is a copy of production requests routed to a new service or version where responses are ignored. A dark launch deploys a feature behind a flag so it runs in production and collects metrics while staying invisible to customers. Together they give you production grade validation of correctness, latency, cost, and safety before any public rollout. If you are preparing for a system design interview, mastering these patterns signals strong judgment about reliability, observability, and release safety in distributed systems and scalable architecture.

Why It Matters

Shadowing and dark launching solve the classic gap between staging and production. Synthetic tests rarely capture real traffic shape, session behavior, cache warmth, data skew, and cross service failure modes.

These techniques let teams

  • reduce blast radius by validating behavior with zero user impact
  • measure p95 and p99 latency under live contention and noisy neighbors
  • uncover data correctness issues and side effects across storage and queues
  • estimate real cost for autoscaling, memory growth, and egress before launch
  • build confidence in rollback and kill switch paths used in mature distributed systems

For interviews, they demonstrate how you de risk changes with observability first thinking and how you balance shipping speed with safety.

How It Works Step by Step

There are two flows to understand. One for shadow traffic and one for dark launch.

Shadow traffic flow

  1. Choose the tap point Duplicate traffic at the edge proxy, API gateway, or service mesh where you can mirror requests without adding latency to the primary path. Typical placements are load balancer layer or sidecar proxy next to the service.

  2. Sampling and routing Start with a small sample like one percent, then increase gradually. Route the mirrored copy to a shadow cluster or a new service version. Add a custom header to mark the request as shadow so downstream systems and logs can separate it from real traffic.

  3. Read only and side effect control Reject writes, or route them to a sandbox. For queues, publish to an isolated topic. For databases, use a replica or a separate cluster. If the new service must execute writes to prove correctness, stub external effects or write to a tombstone table and compare results offline.

  4. Payload scrubbing Remove or tokenize sensitive fields that are not needed by the new service. Make sure compliance rules for user data are respected.

  5. Idempotency and dedupe Shadowed calls are duplicates. Use idempotency keys, no op write modes, or request guards so downstream services are not mutated. For example, attribute shadow requests with a dedicated principal to make any accidental writes easy to detect and purge.

  6. Observability and comparison Tag traces and metrics with a shadow label. Capture latency histograms, error codes, and selected output fields. Run online or offline comparators, for example check that recommendations overlap above a threshold or that fraud scores differ within a tolerance band.

  7. Ramp and exit If results match expectations, increase sample. When stable, switch to a canary or a full rollout. If deltas exceed guardrails, pause automatically with a flag and investigate.

Dark launch flow

  1. Deploy behind a feature flag Ship the code path to production but keep it disabled for users. The service still executes the new logic on a copy of inputs or on mirrored events, logs telemetry, and emits traces.
  2. Scorecard and guardrails Define pass or fail criteria up front. Examples include delta in latency below five percent, error rate below a tight bound, output quality within a known tolerance, and no growth in storage hot keys.
  3. Event taps and data mirrors For read paths, fan out inputs to the new logic. For write paths, compute results in parallel but drop the side effect unless a reviewer flips a flag. Use outbox and change data capture to supply the same event stream to old and new consumers.
  4. Progressive exposure When scorecards look good, enable the feature for staff only, then for a small internal cohort, then for a tiny user slice. Keep an instant off switch ready at every step.

Real World Example

Consider a new recommendation ranking model at a streaming platform like Netflix. The team wants to validate quality and latency with real production traffic.

  • The edge gateway mirrors one percent of browse and search requests to a new ranker cluster.

  • The new ranker computes a ranked list and logs it, but the client still receives the control result generated by the current ranker.

  • A comparator calculates metrics like mean reciprocal rank gain, click probability lift, and coverage delta.

  • Latency budgets are tracked with traces and a shadow label in the telemetry backend.

  • After a week, the ranker passes quality thresholds and p99 latency remains under target. The team moves to a dark launch with a feature flag that serves the new list to staff accounts only.

  • Finally, they run a tiny canary to real users, guarded by automated rollback if any error or latency breach appears.

This flow validates the model in a live distributed system without risking user experience.

Common Pitfalls or Trade offs

Accidental side effects If shadow requests execute writes or publish to shared queues, you can corrupt state. Use strict read only routing, sandbox topics, and database roles that prohibit mutation.

Skewed results due to cache warmth Shadow clusters often start cold. Warm caches with a prefill job or let the system run for enough time before you compare p95 and p99.

Hidden coupling and flaky comparisons Small nondeterminism like time based defaults or randomization can create noise. Pin timestamps, seed random generators, or compare with tolerance bands rather than exact equality.

Insufficient data protection Mirrored payloads may include sensitive data. Tokenize or drop fields not needed by the new logic. Keep data retention short for shadow logs.

Observer overhead on the primary path Mirroring at the wrong place can increase latency. Duplicate asynchronously from the sidecar or gateway and keep extra work off the hot path.

No clear scorecard Without pre agreed success thresholds, teams argue about readiness. Define metrics, time windows, and rollback rules upfront and automate the decision as much as possible.

Interview Tip

A favorite prompt is: explain how you would ship a new search service without impacting users. Strong answers mention traffic mirroring at the gateway, read only shadow cluster, payload scrubbing, trace tags, output comparators, and a feature flag for a dark launch with instant rollback. Mention both latency and correctness guardrails.

Key Takeaways

  • Shadow traffic duplicates live requests to a new service where responses are ignored but metrics are recorded

  • Dark launch runs code in production behind a feature flag to collect telemetry before any exposure

  • Both techniques reduce risk by validating latency, correctness, and cost with real inputs

  • Success depends on read only routing, payload scrubbing, robust observability, and predefined scorecards

  • Use shadowing first, then dark launch, then canary for a clean progression to full rollout

Table of Comparison

TechniqueMain goalRoutes real user requestsRisk to usersBest useNotes on cost
Shadow trafficValidate latency and correctness with live inputsYes as a mirrored copy onlyVery low if writes are blockedNew service or model parity checksExtra compute for the shadow path
Dark launchRun feature in production behind a flagYes but outputs are hiddenLow with strong guardrailsComplex logic that needs end to end validationModerate due to dual execution
Canary releaseExpose a small user sliceYes for a tiny cohortModerate guarded by rollbackFinal confidence before full rolloutSimilar to normal production
Blue greenSwap entire environmentsYes all traffic after switchHigher unless pre validated by shadowingLarge upgrades where a flip is simpleHigh due to duplicate infra
A slash B experimentMeasure user impactYes split by experiment assignmentModerate by designProduct changes needing behavioral dataDepends on cohort size
Synthetic replayStress or regression testsNoNoneLoad testing and failure drillsLower but does not reflect real shape

FAQs

Q1. What is the difference between shadow traffic and dark launch?

Shadow traffic mirrors live requests to a new service for measurement only. Dark launch runs the new code in production behind a feature flag so it executes but does not surface results to users.

Q2. How do I prevent side effects when mirroring traffic?

Route mirrored calls to read only replicas, sandbox topics, or stub external actions. Tag requests as shadow and disallow mutations at the database role level.

Q3. How much traffic should I shadow at first?

Start tiny like one percent to validate plumbing and metrics. Ramp up gradually as scorecards stay green.

Q4. What should I measure during a dark launch?

Track p95 and p99 latency, error codes, resource usage, and output quality metrics that reflect business goals like relevance, fraud catch rate, or fulfillment accuracy.

Q5. Can I shadow asynchronous events, not only request response calls?

Yes. Duplicate queue messages to a shadow topic and run the new consumer in lockstep. Use idempotency keys and separate storage to avoid collisions.

Q6. When do I switch from dark launch to canary?

After scorecards stay within thresholds for a sustained window under peak load and after backfills or cache warming steps are complete.

Further learning

TAGS
System Design Interview
System Design Fundamentals
CONTRIBUTOR
Design Gurus Team
-

GET YOUR FREE

Coding Questions Catalog

Design Gurus Newsletter - Latest from our Blog
Boost your coding skills with our essential coding questions catalog.
Take a step towards a better tech career now!
Image
One-Stop Portal For Tech Interviews.
Copyright © 2025 Design Gurus, LLC. All rights reserved.