Problem statement
Design the platform service that assigns users to A/B experiment variants (buckets) at request time and records that they were exposed. Product teams run hundreds of concurrent experiments; each request that renders UI needs to know, quickly and consistently, which variant of every active experiment the current user is in.
Operating context. Assignment must be sticky: the same user gets the same variant every time, across sessions and devices, for the life of the experiment. Some experiments are mutually exclusive and share a traffic layer so a user can be in at most one of them. Every assignment that actually influences what a user sees must produce an exposure event for later analysis. Experiment configuration (traffic splits, targeting, on/off) changes many times a day and must reach the fleet quickly.
Out of scope. The statistical analysis pipeline and significance testing, the experiment-authoring console, long-term event warehousing, and personalization or ML ranking. Assume other teams own those.
What to produce. A high-level architecture covering: how a variant is computed deterministically from user and experiment identity, how stickiness is guaranteed without storing a row per user per experiment, how mutually exclusive experiment layers are kept non-overlapping, how config is distributed and how stale config is bounded, how exposures are logged off the hot path without inflating latency, and how the read path stays fast and available. Sketch the components and the request flow; we will probe specifics in checkpoints.
Functional requirements
- Given a user and the set of active experiments, return the assigned variant for each in a single fast call.
- Guarantee sticky assignment: the same user maps to the same variant for an experiment's lifetime.
- Enforce mutually exclusive experiment layers so a user is in at most one experiment per layer.
- Emit an exposure event whenever an assignment is actually used to render something.
- Propagate experiment configuration changes (splits, targeting, start/stop) to the serving fleet quickly.
Non-functional requirements
- Serve 1,000,000 assignment lookups/sec globally, with bursts at product launches.
- Assignment lookup p99 < 10 ms including all active experiments for a user.
- Config changes reach every serving node within 30 s (bounded staleness).
- Assignment is deterministic: identical user + experiment + config yields the identical variant on every node.
- 99.95% availability for the assignment read path; degrade to control/default variant rather than error.
- Support 500 concurrently active experiments and 200,000,000 users.
Topics
- System Design HLD
- Platform Experimentation
- Data Hashing
- Scaling Read-Heavy
- Consistency Deterministic