Skip to content
SD-29 · System design

Design a A/B Testing Platform

Asked at Senior level45 minutes
Our answers stay hidden until you reveal them.

Design a platform that lets product teams run experiments: show some users a new checkout button and others the old one, then measure which one leads to more purchases. A team defines an experiment with its variants, who is eligible and what share of traffic it gets; apps and servers ask “which variant is this user in?”; and the platform reports, for each metric, how each variant did and whether the difference is real or noise.

The company has 300 million daily users and runs 1,000 experiments at once. Apps check flags about 80 billion times a day and send 20 billion events a day. The hard part is in three places: a flag check runs on the request path, so it must take well under a millisecond and never fail open into a random variant; the event pipeline must take 500,000 events a second without losing or double counting them; and the statistics must be trustworthy, because a wrong “winner” ships a worse product to everyone.

Good questions to ask first

Decide what you would assume for each before you look at ours.

  1. 1Who checks flags: apps, servers or both?
  2. 2What is a user?
  3. 3How many experiments at once?
  4. 4Which metrics?
  5. 5How fast must a change take effect?
  6. 6Do we need statistics beyond the averages?
  7. 7Can an experiment target a group?
  8. 8How long do we keep data?

How to spend the 45 minutes

  1. 5minPart 1: Requirements and scope
  2. 5minPart 2: Estimates
  3. 5minPart 3: API
  4. 15minPart 4: Architecture, stage by stage
  5. 15minPart 5: Deep dives and trade-offs
Sketch your own design: boxes, arrows and the numbers that matter. Then compare it with ours.Break it in the labVisual walkthrough