Lesson 24 / 26
Shadowing, Blue-Green and Progressive Delivery
Test new versions with mirrored traffic and switch over safely.
Prove it before users depend on it
Traffic shadowing (mirroring) copies live requests to a new version and discards its responses, so you can compare behaviour and load with zero user impact (be careful with requests that cause side effects). Blue-green runs two full environments: switch the gateway from blue to green in one step and switch back instantly if something is wrong; it needs double capacity and careful database compatibility. Canary shifts traffic gradually with metric checks. Progressive delivery tools (such as Argo Rollouts or Flagger) automate these steps: shift 5%, check error rate and latency, continue or roll back. Always keep the database migration backward compatible during rollouts, so both versions can run at once.
Mirroring in nginx (illustrative)
The mirror directive sends a copy of each request to the shadow upstream; its response is ignored. Not run here.
location /orders/ {
mirror /shadow;
mirror_request_body on;
proxy_pass http://orders_stable/;
}
location = /shadow { internal; proxy_pass http://orders_canary$request_uri; }An automated rollout plan
Write the promotion rules down so the tool, not a person at 2 a.m., decides.
step 1 mirror 100% (no user impact) compare errors + latency for 15 min
step 2 canary 5% continue if 5xx < 0.5% and p99 < 1.2x baseline
step 3 canary 25% -> 50% -> 100% hold 10 min at each step
abort any check fails shift back to 0%, page the owner
after keep old version warm 24 h then remove; schema changes stay backward compatibleQuick check: What is traffic mirroring used for?
- Encrypting traffic
- Doubling user-visible responses
- Testing a new version with real traffic copies without affecting users
- Caching static files
Answer
Testing a new version with real traffic copies without affecting users — Mirrored responses are discarded, so only the test target is exercised.