Problem statement
Design a service that runs controlled price experiments for an online store: it assigns each shopper to a price variant, serves that variant at page-render time, and records exposure and conversion so analysts can measure impact.
Operating context. Analysts define experiments (a base price, one or more variant prices, a traffic split, targeting rules, and guardrails). At request time the storefront asks 'what price should this shopper see for this product?' and expects an answer fast enough to render synchronously. A shopper must see a stable price for the life of the experiment — flipping prices between page loads erodes trust and corrupts the analysis. Every exposure and any resulting purchase must be attributed to the assigned variant. Read volume is heavy: about 80000 price lookups/sec at peak; experiment definitions change rarely by comparison.
Out of scope. The statistical analysis engine and significance testing, the base-price catalog system, the checkout and tax pipeline, and personalized ML pricing. Assume the base price and product catalog are provided by other services.
What to produce. A high-level architecture covering: how a shopper is deterministically assigned to a variant, how assignment stays sticky across sessions and devices, how the price is served with very low latency and a safe fallback, how experiment definitions propagate to the serving tier, and how exposure/conversion events are captured off the hot path for later analysis. Sketch the components and trace a price lookup from storefront request to served price plus recorded exposure.
Functional requirements
- Deterministically assign a shopper or session to a variant of each running experiment they qualify for.
- Serve the assigned variant price for a product at request time, falling back to the base price on any failure.
- Keep a shopper's assignment sticky for the full duration of an experiment across sessions and devices.
- Record exposure events and attribute downstream conversions to the served variant.
- Let analysts create, target, start, and stop experiments and adjust traffic splits without a deploy.
Non-functional requirements
- Serve 80000 price lookups/sec at peak with p99 < 20 ms on the serve path.
- Assignment is deterministic and stable for the same shopper across devices and time.
- Experiment definition and split changes reach all serving nodes within 30 s.
- 99.99% availability on price serving; a lookup failure never blocks page render (base-price fallback).
- Retain exposure and conversion events 90 days (~5 TB) for offline analysis.
Topics
- System Design HLD
- Commerce Pricing
- Experimentation Ab
- Data Cache
- Scaling Read-Heavy