Skip to content
tezvyn:

Canary vs shadow deployments: use cases and requirements

Source: launchdarkly.comHardHow cards are made

Canary vs shadow deployments: use cases and requirements

This tests whether you distinguish user-facing rollouts from invisible duplication. Canary routes some real users to new code to limit blast radius; shadow mirrors traffic to an isolated clone to test performance without user impact.

What's really being asked

This question probes your ability to differentiate two advanced deployment patterns that both reduce risk but serve fundamentally different validation goals. Interviewers want to see that you understand traffic routing mechanics, infrastructure cost tradeoffs, and the distinction between testing with real users versus testing with real traffic in isolation. The underlying theme is whether you can select the right safety mechanism based on what you are trying to validate.

The full answer

First, define canary deployment as a technique that routes a small percentage of actual user traffic to the new version while the majority remains on the stable version, allowing you to monitor error rates, latency, and business metrics with a limited blast radius. Second, define shadow deployment as traffic mirroring that sends a copy of production requests to the new version without returning its responses to users, letting you test performance, resource consumption, and correctness at full scale without any user impact. Third, contrast infrastructure requirements: canary needs load balancers, routing rules, and observability tied to user sessions, whereas shadow needs duplicate compute capacity and careful isolation so that mirrored traffic does not trigger side effects like duplicate payments or notifications. Fourth, explain when to choose each: use canary when you need to validate user-facing behavior, feature semantics, or gradual rollout tolerance; use shadow when you need to validate performance under production load, detect race conditions, or benchmark infrastructure before any user sees the change. Fifth, mention that feature flags can decouple deployment from release for both strategies, reducing the need to stand up entirely duplicate environments.

The mistakes people make

A major red flag is claiming that shadow deployments provide a rollback safety net for user-visible bugs; since shadow traffic never returns responses to users, it cannot validate user experience or catch UI defects. Another mistake is stating that canary testing gives you full performance characterization without user impact; in reality, canary exposes users to potential latency spikes or errors, so it carries user-facing risk that shadow avoids. Candidates also err by saying the infrastructure is identical for both; shadow typically requires double the compute to process mirrored traffic, while canary requires sophisticated routing and sticky session handling.

What usually comes next

The interviewer may ask how you would handle database schema changes during a canary rollout, or how you prevent shadow traffic from corrupting production state. They might also ask you to compare cost profiles, or to sketch an architecture using feature flags instead of load balancer rules to achieve the same goals.

A concrete example

Imagine migrating a payment service to a new framework. A shadow deployment would mirror checkout requests to the new service to measure latency and memory usage against the old service, discarding the responses so no real charges occur. Once performance is validated, a canary deployment would shift one percent of real checkout traffic to the new framework, monitoring payment success rates and refund rates before scaling to ten percent and beyond.

Interview question

When migrating a payment service to a new framework, how can you measure latency under production load without risking duplicate charges or user impact?

  • a.Canary deployment with feature flags to duplicate the environment and compare responses without users seeing the new version
  • b.Canary deployment routing a small percentage of real users to the new version, using sticky sessions to limit the blast radius if duplicate charges occur
  • c.Shadow deployment mirroring production traffic to an isolated clone while ensuring mirrored requests cannot trigger side effects like duplicate paymentsCorrect
  • d.Shadow deployment routing 5% of users to the new version and discarding responses to prevent duplicate charges
Why?

Shadow deployment mirrors production traffic to an isolated clone, letting you measure latency without user impact as long as you prevent side effects like duplicate payments. Canary deployment is tempting but wrong because it routes real users to the new version, inherently exposing them to risk and potential duplicate charges rather than isolating them.

Just read this? Test yourself on what you have been reading.

Read the original → launchdarkly.com

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on ci/cd — each one lists the topics its interview covers.

See open roles