Design an experiment assignment service

Quick Overview

This question evaluates system-design and analytics competencies for online experimentation platforms in the Analytics & Experimentation domain, focusing on deterministic sticky assignment, configuration storage, eligibility targeting, traffic allocation, mutual exclusion, overrides, exposure logging, metric tagging, privacy/compliance, latency and availability targets, experiment lifecycle, and high-level architecture. It is commonly asked because it assesses both conceptual understanding and practical system-design application of distributed-system trade-offs, scalability, data integrity, operational reliability, and privacy constraints, and gauges the ability to define high-level APIs, architecture, and justify key trade-offs.

Design an experiment assignment service

Company: Visa

Role: Software Engineer

Category: Analytics & Experimentation

Difficulty: hard

Interview Round: Technical Screen

Design an online experimentation (A/B testing) assignment service. The API input is (userId, featureName) and it returns a variant identifier (e.g., control or treatment). Clarify and specify: deterministic sticky assignment and bucketing strategy, configuration storage for experiments and features, eligibility targeting and audience filters, traffic allocation and ramps, mutual exclusion and experiment layering, overrides (holdouts, QA, killswitch), exposure logging and idempotency, metric tagging and data pipeline, privacy and compliance (e.g., GDPR/CCPA), latency/availability targets and fallbacks, and the experiment lifecycle (create, start, pause, stop, analyze). Provide a high-level architecture and key components.

Overview: This question evaluates system-design and analytics competencies for online experimentation platforms in the Analytics & Experimentation domain, focusing on deterministic sticky assignment, configuration storage, eligibility targeting, traffic allocation, mutual exclusion, overrides, exposure logging, metric tagging, privacy/compliance, latency and availability targets, experiment lifecycle, and high-level architecture. It is commonly asked because it assesses both conceptual understanding and practical system-design application of distributed-system trade-offs, scalability, data integrity, operational reliability, and privacy constraints, and gauges the ability to define high-level APIs, architecture, and justify key trade-offs.

Community answers

Answer by chengchenghuang77

┌───────────────────────┐ │ Experiment Mgmt UI/API │ create / review / ramp / pause └──────────┬────────────┘ ▼ ┌───────────────────────┐ strongly consistent, versioned, │ Config DB + audit log │ audit trail (Postgres / Spanner) └──────────┬────────────┘ ▼ ┌───────────────────────┐ validates conflicts, compiles an │ Config compiler/publisher│ immutable snapshot vN (protobuf) └──────────┬────────────┘ push (stream) │ + poll fallback (CDN / blob store) ┌─────────────────┼───────────────────────┐ ▼ ▼ ▼ ┌──────────┐ ┌──────────────────┐ ┌────────────────┐ │Server SDK│ │ Assignment API │ │ Edge/CDN copy │ │(in-proc │ │ stateless, multi-│ │ of snapshot │ │ eval) │ │ region, edge │ └────────────────┘ └────┬─────┘ └────────┬─────────┘ │ ▲ assign() │ web / iOS / Android SDKs (cache + bootstrap) │ │ └──────► exposure events ◄──────┘ ▼ Collector → Kafka → Stream processor ──► guardrail monitor, │ (dedupe, SRM) auto-killswitch ▼ Warehouse ──► Analysis engine ──► scorecards Key components: Management plane: UI and API, review workflow, audit log. Config store: the source of truth. Strongly consistent and versioned. Compiler/publisher: validates configs and produces an immutable snapshot configVersion = N. Distribution: streaming push plus a polling fallback from blob storage or CDN. Evaluation: server SDKs evaluate in process. A stateless Assignment API serves thin clients. Both run the same evaluation library so results match. Exposure pipeline: collector → Kafka → stream processor → war
Visa logo
Visa
Aug 11, 2025
hardSoftware EngineerTechnical ScreenAnalytics & Experimentation
13
0

Design an Online Experimentation (A/B Testing) Assignment Service

You are asked to design a highly available online experiment assignment service. The service exposes an API that takes (userId, featureName) and returns a variant identifier (e.g., control or treatment). Assume the service will be used by web and mobile applications globally and must support both logged-in and logged-out users.

Clarify, specify, and propose designs for the following:

  1. Deterministic sticky assignment and bucketing strategy
  2. Configuration storage for experiments and features
  3. Eligibility targeting and audience filters
  4. Traffic allocation and ramps
  5. Mutual exclusion and experiment layering
  6. Overrides (holdouts, QA, killswitch)
  7. Exposure logging and idempotency
  8. Metric tagging and data pipeline
  9. Privacy and compliance (e.g., GDPR/CCPA)
  10. Latency/availability targets and fallbacks
  11. Experiment lifecycle (create, start, pause, stop, analyze)
  12. High-level architecture and key components

Provide a high-level architecture, key APIs, and justify key trade-offs. Where relevant, include small examples and precise definitions (e.g., hashing and bucket math, namespace/layering).