Shadow Deployment: Rehearsing a Release with Live Traffic

Shadow deployment is like a stunt double for your service: it receives a copy of live production traffic to test a new version without impacting users. Use it to validate performance and find bugs under real load.
Why it exists
Staging environments rarely replicate the scale, load, and chaotic nature of production. Deploying a new service version based only on staging tests is a gamble that can lead to performance degradation or outages. Shadow deployment was created to solve this by enabling realistic testing without risk to live users.
The mental model
Think of shadow deployment as a flight simulator for your code. The simulator is fed real-time weather and air traffic data (production requests) and the pilot (your new service version) can fly the plane. The simulator's actions don't affect any real aircraft, but you can analyze its flight recorder (logs and metrics) to see exactly how it performed under pressure.
How it works
A traffic-routing component, like a proxy or service mesh, is placed in front of your service. When a request arrives, it's forwarded to the current, live version which returns a response to the user as normal. Simultaneously, the router duplicates the request and sends it to the new, shadow version. The shadow service processes the request, but its response is discarded or sent to a logging system for analysis. The user is completely unaware the shadow service exists.
When to use it
Use shadow deployment to de-risk critical changes. It's perfect for testing a new algorithm's performance, validating the impact of a database schema change, or ensuring a major refactor behaves identically to the old code. By comparing the performance and error metrics of the shadow version against the live version, you can gain high confidence before a full rollout.
When not to use it
Avoid shadow deployment for services with write operations that can't be isolated. If your shadow service writes to the same production database as your live service, you risk data corruption. This is the primary footgun. Also, be mindful of the cost: running a full shadow copy of a service effectively doubles its infrastructure requirements (CPU, memory, etc.), which can be expensive.
One canonical example
A team rewrites a product recommendation engine. Before going live, they deploy the new version as a shadow. For several days, it receives a copy of all recommendation requests from production users. The team compares the latency, CPU usage, and error rates of the shadow against the live version. They also log the shadow's generated recommendations to verify quality, all without any user ever seeing a result from the new, unproven code.
Interview question
Which characteristic primarily enables shadow deployment to test new service versions with live traffic without impacting end-users?
- a.The new version's processing results are captured for analysis but never returned to the user.Correct
- b.It performs tests exclusively on read-only operations to prevent data corruption.
- c.It routes only a small, controlled percentage of live traffic to the new version.
- d.It runs the new version in a completely isolated, non-production environment.
Why? this is the answer
Shadow deployment's safety comes from duplicating live requests to the new version, but discarding its response, ensuring users are unaffected. Option C describes a canary deployment, which exposes a new version's responses to a subset of users.
Just read this? Test yourself on what you have been reading.
Read the original → geeksforgeeks.org
- #ci/cd
- #deployment strategies
- #microservices
- #testing
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.
We are hiring for this. Open roles that interview on ci/cd — each one lists the topics its interview covers.
See open roles