Describe the architecture of an A/B testing framework

This tests your system design skills for experimentation, from user bucketing to statistical analysis. A good answer covers user assignment, a config service, a data pipeline, and a results layer with statistical significance.
What's really being asked
This question assesses your understanding of the end-to-end lifecycle of an experiment. It's not just about flipping a coin for users. Interviewers are looking for your ability to design a robust, scalable, and statistically sound system. They want to see if you think about data integrity, user experience consistency, and the potential for misuse or misinterpretation of results by non-technical stakeholders. This is a product-minded system design question.
The full answer
A strong answer will walk through four distinct components. First, user assignment: a deterministic, stateless method like hashing a stable user ID (e.g., hash(userID + experimentID) % 100) to bucket users into variants. This ensures a user consistently sees the same experience. Second, experiment configuration: a centralized service that holds experiment definitions (name, variants, traffic allocation, targeting rules) and serves them to clients. This allows for dynamic start/stop of experiments without code deploys. Third, the data pipeline: clients fire exposure events (user X saw variant A) and conversion events (user X clicked 'buy'). These flow into a data warehouse, where an ETL/ELT job joins them and calculates metrics per variant. Fourth, results presentation: a UI that shows key metrics, the lift (or drop), and crucially, statistical significance measures like p-values and confidence intervals to prevent premature conclusions based on noise.
The mistakes people make
A major red flag is focusing only on the client-side implementation, like if (Math.random() > 0.5). This is not scalable, deterministic, or consistent across sessions/devices. Another common error is neglecting the "exposure event" log; you cannot calculate a conversion rate (conversions / users) if you don't know how many users were in each group. Finally, simply presenting raw conversion counts (e.g., "Variant A got 100 clicks, B got 105") without statistical context is a sign of a junior answer. It ignores sample size and variance.
What usually comes next
Be ready for questions about interaction effects ("What if a user is in two experiments at once?"). The answer involves orthogonal experiment layers or ensuring experiments don't target overlapping user attributes. Another follow-up is about duration: "How long should an experiment run?" The answer is until it reaches a pre-calculated required sample size to achieve statistical power, not just "until the results look good" (p-hacking). They might also ask about handling non-logged-in users (using a device ID or cookie, with caveats).
A concrete example
To test a new checkout button color, we define an experiment with 50% of traffic on "control" (blue) and 50% on "variant" (green). A user with ID 12345 logs in. The client requests experiment configs. The assignment logic computes hash('12345' + 'checkout-color-exp') % 100, which returns 67. Since 67 is > 50, the user is assigned to the "variant" group and sees the green button. The client fires an exposure event: {userID: '12345', experiment: 'checkout-color-exp', variant: 'green'}. If they complete a purchase, a conversion event is fired. After 2 weeks and 500,000 exposed users, the results UI shows the green button has a 4.1% conversion rate vs. blue's 4.0%, with a p-value of 0.04, indicating the result is statistically significant.
Interview question
Which of the following is the primary benefit of using a deterministic hashing function for user assignment in an A/B testing framework?
- a.To ensure users are evenly distributed across all experiment variants.
- b.To enable real-time adjustment of experiment traffic percentages.
- c.To simplify the collection of raw conversion counts for each variant.
- d.To guarantee that a user consistently experiences the same variant across multiple sessions.Correct
Why? this is the answer
A deterministic hashing function for user assignment ensures that a specific user consistently sees the same variant every time, which is crucial for reliable experiment results. While hashing aids in even distribution, its deterministic nature specifically addresses user consistency, not just overall traffic allocation or data collection.
Just read this? Test yourself on what you have been reading.
Read the original → en.wikipedia.org
- #system design
- #analytics
- #a/b testing
- #data pipeline
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
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 system design — each one lists the topics its interview covers.
See open roles