A/B testing
Route user segments to variants and measure outcomes.
A/B testing uses the same routing machinery as a canary, but it answers a different question. A canary asks whether the new version is safe. An A/B test asks whether it is better: does variant B lead to more sign-ups, sales or engagement? Users are split into stable groups, each always sees the same variant, and you compare a business metric across them.
0.0s / 18s
Step 1 of 5: Everyone sees A. v1 is variant A, the control.
- Availability
- 100%
- No downtime
- Pods running
- 1.00×
- Peak 1.00× of normal
- Blast radius
- —
- Inject a bug to measure
- Time to recover
- —
- No incident
Conversion (illustrative)A0.0% of 0B0.0% of 0
v1 (current)v2 (new)StartingIdle or shadow (no user traffic)User pinned to v2SucceededFailed
Trade-offs
More filled is better for you- Uptime during deploy
- 4 out of 4.No downtime
- Low infra cost
- 3 out of 4.Variant pods alongside
- Rollback speed
- 3 out of 4.Stop the experiment
- Small blast radius
- 1 out of 4.A whole cohort, often 50%
- Simplicity
- 1 out of 4.Bucketing, analytics, statistics
- One version at a time
- 2 out of 4.Sticky per user, mixed overall
Pros and cons
Pros
- Decisions based on evidence about user behaviour, not opinion.
- Sticky assignment gives each user a consistent experience.
- Can target segments: country, device, plan, new vs returning.
Cons
- Not a safety mechanism. Cohorts are big, so a bug hits a lot of users.
- Needs enough traffic and time to reach statistical significance.
- Analytics, event tracking and experiment hygiene add real overhead.
When to reach for it
Use it when
- Product changes whose value is uncertain: pricing pages, onboarding, ranking.
- You have the traffic volume to measure the difference you care about.
Avoid it when
- You just want to ship safely. That's what a canary is for.
- Low traffic, or a metric that takes weeks to move.
How to do it
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
name: shop
spec:
hosts: [shop]
http:
- match: # users already bucketed into B
- headers:
cookie:
regex: "^(.*?;)?(experiment=b)(;.*)?$"
route:
- destination: { host: shop, subset: v2 }
- route: # everyone else sees A
- destination: { host: shop, subset: v1 }Gotchas
- Peeking at results early and stopping when it looks good inflates false positives. Fix the sample size or use sequential methods.
- Assign by a stable ID (user, account), not per request, or users will flip between variants.
- Always watch guardrail metrics such as error rate and latency alongside the goal metric.
- Most A/B tests in practice live inside one deployment, behind a feature flag, rather than as separate versions.