We Had 10k Metrics, 500 A/B Experiments and 500kk p-values Every Day…

Danila Lenkov16 Sep 2025

Problem

Avito has more than 250 autonomous product teams and over 500 analysts running A/B tests. Without a shared platform, analysts compute metrics differently and results of the same test diverge. The shared platform must calculate 10,000 metrics across hundreds of slices for about 500 experiments a day, and plain SQL on raw events stops working at that size, especially for tests that run 90 days or more.

Example from the article: one experiment starts from 2 billion events. Joining them with experiment assignments multiplies the volume by 20, and adding metrics and slices multiplies it again, beyond the memory of any cluster.

Solution in brief

Metric logic lives in one semantic layer of configuration files, and the platform generates the calculation code from it. Avito stores aggregates per hash bucket (256 buckets) instead of per user. The metric computation runs as a custom Java function inside Trino, which processes one user at a time and drops unneeded metric-slice combinations early.

Questions this case answers
  • How to compute many metrics and slices for many concurrent experiments on user-level event data when most combinations are never read and a plain SQL join exceeds cluster memory
  • How to keep metric definitions consistent across many autonomous teams so that the same test gives the same result for every analyst
  • How to keep metric definitions identical across hundreds of product teams that run A/B tests?
  • How to compute thousands of metrics for hundreds of daily experiments without a cost explosion?

Tools and methods

  • Semantic layer — config files with source queries, join rules, metric formulas and slices
  • Domains — per-team sets of metrics and slices to compute
  • Hash bucketing — aggregates by bucket instead of user ID
  • Trino with a Java function plugin — runs the metric calculation
  • Apache Iceberg, Kubernetes, Apache Airflow — lakehouse with compute separated from storage
  • ClickHouse — serves results to the report interface
Continue reading — it's free

Google or a one-time email code. No password.