The shadow test that missed the dangerous requests
Failure story 16, in migration, backfills and cutovers.
The challenge
Section titled “The challenge”For a week, the new pricing service ran in shadow mode against the old one, and the comparison showed 100% agreement. On the day it went live, large orders started failing. How did the shadow test miss them?
The setup
Section titled “The setup”| Assumption | Value |
|---|---|
| Shadow mode | Every pricing request is sent to the old service (whose answer is used) and copied to the new one (whose answer is only compared) |
| Comparator | For each request, waits up to 2 seconds for both responses and records match or mismatch |
| Report | Agreement = matches ÷ (matches + mismatches) |
| Release gate | Agreement of at least 99.9% for 7 days |
What happened
Section titled “What happened”| Step | What happens |
|---|---|
| 1 | A typical hour: 1,000 eligible requests are mirrored to the new service. |
| 2 | 950 finish within 2 seconds, and every one matches the old service. |
| 3 | 50 don’t finish within 2 seconds. They’re orders with more than 200 line items, where the new service makes one call per line. |
| 4 | The comparator has no pair for those 50, so it records nothing. |
| 5 | The report shows 950 matches and 0 mismatches: 100% agreement. The gate passes every day. |
| 6 | Go-live: the 50 slowest requests an hour now time out for real customers, and they’re the biggest orders the business has. |
Why it went wrong
Section titled “Why it went wrong”The report measured agreement among the requests that finished. The requests that didn’t finish were exactly the ones the new system handled worst, and they left the denominator silently. A comparison that drops its hardest cases can only ever look good. Worse, the number it reports is accurate, so nobody distrusts it.
Two designs
Section titled “Two designs”| Aspect | Design A: matched-pairs reporting | Design B: every eligible request accounted for |
|---|---|---|
| Denominator | Pairs that completed | Every request that was eligible to be shadowed |
| Outcomes recorded | Match, mismatch | Match, mismatch, candidate missing (timeout or error), primary missing, not sampled |
| Release gate | Agreement ≥ 99.9% | Coverage ≥ 99% and agreement ≥ 99.9% |
| The hour above | 100% agreement, gate passes | Coverage 95%, gate fails |
The same hour, reported both ways:
| Outcome | Count |
|---|---|
| Eligible requests | 1,000 |
| Matched | 950 |
| Mismatched | 0 |
| Candidate missing (timed out) | 50 |
| Coverage: compared ÷ eligible | 95.0% |
| Agreement: matched ÷ compared | 100% |
The check
Section titled “The check”Feed the comparator a known hour: 1,000 eligible requests, 950 matching responses and 50 candidate timeouts.
- Expected: the report shows 950 matches and 50 missing responses separately, not only a percentage.
- Expected: a release threshold requiring 99% comparison coverage fails.
- Expected: the 50 missing requests can be listed and replayed, so someone can see what they have in common.
This check is in the checks catalog as test templates in Java and Python.
When the simpler design is enough
Section titled “When the simpler design is enough”- Missing responses are vanishingly rare and random, and you measure that rather than assume it. The moment they cluster by request type, the simpler report is misleading.
For educators
Section titled “For educators”Discussion question. What other reports drop their hardest cases from the denominator? Common examples: average latency of successful requests, test pass rates that exclude skipped tests, and customer satisfaction scores from customers who finished the survey.
Exercise. The team argues that the 50 timeouts are an artifact: the shadow runs on smaller instances than production will. How would you settle the argument without removing the 50 from the report?
Worked answer
Keep them in the denominator and investigate them as a group. Give the shadow a longer timeout than the user path, because nothing is waiting for it, and record its latency separately from correctness, so a slow-but-correct answer counts as a match with a latency finding. Classify missing responses by reason (timeout, error, crash) and by request shape (line-item count). Then replay the 50 against a production-size instance. If they complete correctly and fast enough, the team was right and the report says so; if they don’t, the report found the problem it exists to find. What you don’t do is decide in advance that the missing cases don’t count.
Further reading
Section titled “Further reading”- GitHub’s Scientist (opens in a new tab) library, for running a candidate code path alongside the existing one and comparing results.
Related pages
Section titled “Related pages”- Example Lending, ADR-011: run the decision service in parallel with the batch
- Performance engineering
- The green canary that failed a small tenant, on aggregates that hide the cases that matter
Written and edited by Abhinav Taduka, enterprise software architect.
New pages are added regularly. Follow Abhinav on LinkedIn to see them first.