Show different versions to different users and measure which one wins.
A/B testing means showing two versions of something (A and B) to different groups of real users, and measuring which version gets a better result. The infrastructure is the machinery that makes this fair, repeatable and safe.
Imagine you changed the colour of the "Buy" button. Sales went up the next week. Was it the button? Maybe it was payday, or a sale, or just a lucky week. You cannot know. An A/B test removes this doubt: during the same days, half of the users see the old button (A, the control) and half see the new one (B, the variant). Everything else is equal, so a difference in results can be blamed on the button.
To run this at scale you need more than an if statement. You need a way to assign users to groups, a way to serve the right version, a way to record what each user did, and a way to analyse the results correctly.
experiment name + user id gives a number from 0 to 1 that never changes for that user. If the number is below 0.5 the user is in B. No database lookup is needed, and every server agrees.| Part | Job | Good to know |
|---|---|---|
| Assignment service | Decide the group for a user and an experiment | Hash (experiment name + user id). Same input gives the same group, with no storage. |
| Config / experiment registry | Store which experiments are live, the traffic split and the targeting rules | Changes should take effect without a deploy, like a feature flag. |
| Exposure logging | Record that the user really saw the version | Log at the moment of display. Counting users who were assigned but never saw it dilutes the result. |
| Event pipeline | Collect clicks, purchases and other actions | Events carry the user id, so they can be joined with the group. |
| Metrics layer | Turn events into numbers: conversion, revenue per user, latency | Define each metric once, so every team measures it the same way. |
| Stats engine | Compare the groups and report confidence | Must handle sample size, p-values or Bayesian results, and the checks below. |
| Check | What it catches |
|---|---|
| Sample ratio mismatch (SRM) | You asked for a 50/50 split but got 52/48. This usually means a bug in assignment or logging, and the result cannot be trusted. |
| A/A test | Two identical versions. A healthy system shows “no difference” about 95 times in 100. |
| Guardrail metrics | Things that must not get worse (page speed, errors, unsubscribes) even if the main metric improves. |
| Sample size plan | Decide before you start how many users you need, and do not stop sooner. |
| Mutual exclusion / layers | Stop two tests that touch the same screen from mixing their effects. |
A simplified model with fixed hashes and no random numbers. A converts at 10.0%. Group sizes follow the traffic split, so they are not exactly equal. The users needed use the rule of thumb n = 16 × p × (1 − p) / difference², for about 80% power at 5% significance. Illustrative numbers, not a real product.
| Term | Meaning in easy words |
|---|---|
| Control (A) | The current version that everything is compared against |
| Variant (B) | The new version you are testing |
| Bucketing | Placing each user in a group, usually by hashing the user id |
| Sticky assignment | The same user always gets the same version |
| Exposure | The moment a user actually sees a version |
| Conversion rate | The share of users who did the wanted action, such as buying |
| Lift | How much better B is than A, as a percentage |
| p-value | How surprising the result would be if there were really no difference. Below 0.05 is the usual line for “significant” |
| Statistical power | The chance of spotting a real effect. About 80% is common |
| Sample ratio mismatch (SRM) | Group sizes differ from the planned split, a warning that something is broken |
| Guardrail metric | A metric that must not get worse, even if the main one improves |
| Choice | We gain | We lose |
|---|---|---|
| Small traffic share for B | Low risk if B is bad | A longer test to reach the sample size |
| Large traffic share for B | A faster answer | More users see a possibly bad version |
| Stop early at a good result | Quick decision | Many false winners, and exaggerated effects |
| Many metrics | A fuller picture | More chances for a lucky “significant” one by chance |
| Build it yourself | Fits your data and rules | A lot of work to get the statistics right |
| Buy a platform | Tested statistics and a UI | Cost, and your data goes to another system |