How would you structure a backend architecture A/B test and define metrics?

This tests causal inference rigor for infrastructure changes. A strong answer covers sticky user routing, controlling for geography and time, and paired primary metrics like P99 latency and error rate.
What's really being asked
This question evaluates your ability to apply causal inference to infrastructure rather than product features. Interviewers want to see if you understand that backend A/B tests violate standard assumptions because users share caches, databases, and network paths, and because latency distributions are highly skewed. The goal is to see if you can isolate architecture from deployment noise, user heterogeneity, and time-based confounders.
The full answer
A good answer hits four things in order. First, define the unit of randomization and enforce sticky routing so that a single user consistently hits the same backend variant for the duration of the experiment, preventing cross-contamination. Second, control for covariates by stratifying on region, device type, or time-of-day before randomization, because latency varies massively across these dimensions. Third, isolate the architecture from the deployment by running a parallel canary or a holdback group at identical traffic percentages, ensuring that any observed difference stems from code paths rather than rollout transient errors or cache warm-up. Fourth, define paired primary metrics: a system-level metric like P99 latency or P99.9 latency measured at the edge, and a user-facing guardrail metric like task completion rate or perceived load time, because architecture changes can improve milliseconds while breaking user flows.
The mistakes people make
Common wrong answers include suggesting simple 50-50 traffic splitting without user stickiness, which creates a terrible user experience when stateful requests bounce between architectures. Another red flag is relying solely on mean latency instead of tail latencies, since architecture changes often hurt the long tail while leaving the average untouched. A third mistake is ignoring SUTVA, the assumption that one user's treatment does not affect another's outcome, which fails when variants share a database or cache pool and one variant hogs resources.
What usually comes next
Interviewers often push deeper with questions like: how would you detect cache pollution between variants, what sample size is needed to detect a 20 millisecond P99 improvement, how do you handle rollback if the guardrail metric degrades but the latency metric improves, or how would you adapt this framework to a multi-region active-active setup.
A concrete example
Imagine migrating from a monolithic synchronous API to an async event-driven service. You would bucket users by a hash of their session ID modulo 100, route 5 percent to the async variant, and keep them sticky for two weeks. You would stratify by AWS region to balance network distance. Primary objectives would be P99 latency on the checkout endpoint dropping from 800 ms to under 600 ms, error rate staying below 0.1 percent, and checkout completion rate remaining flat or improving. You would pre-register a rollback rule: if error rate exceeds 0.15 percent at any point, the test stops automatically.
Interview question
When A/B testing a backend architecture change with shared database pools, which experimental design most rigorously isolates the architecture effect from confounders?
- a.Deploy a 5% canary of the new variant, measure P99 latency, and compare against historical data from the week before
- b.Bucket users by session ID hash for sticky routing, stratify by region, pair P99 latency with a user completion metric, and run a parallel holdback at identical traffic percentageCorrect
- c.Split requests 50/50 without stickiness, use mean latency as the primary metric, and compare against pre-launch baseline data
- d.Hash user IDs for sticky routing and track P99 latency, but skip stratification and rely only on server-side error rate without a user guardrail
Why? this is the answer
Option B correctly combines sticky routing, regional stratification, paired P99 and user-completion metrics, and a parallel holdback to isolate architecture effects. Option D is tempting because it includes stickiness and P99 latency, but omitting stratification and a user-facing guardrail leaves the test vulnerable to regional confounders and silent UX regressions.
Just read this? Test yourself on what you have been reading.
Read the original → en.wikipedia.org
- #ab testing
- #backend architecture
- #experimental design
- #latency
- #infrastructure
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. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles