Calculating A/B test metrics at Coupang: from daily incremental Hive to a Spark Lambda architecture

Beibei Ye, Isabelle Phan3 Aug 2022

Problem

Coupang's experimentation platform must show business users A/B test metrics soon after events happen. The first version (2014) ran one HiveQL script a day that added the day's data to yesterday's cumulative result. About 20 tests took nearly 3 hours, and a day's metrics appeared at 2 p.m. the next day. A bug found days later forced recalculation of every following day, and one faulty test could not be fixed alone because all concurrent tests were processed together. The team needed fresh metrics several times a day for 200+ tests.

Example from the article: a bug found several days later meant postponing all other jobs and recomputing every day since the bug.

Solution in brief

Split the input by test and run each test as a separate parallel Spark computation, so a failure or rerun touches only one test. Use a Lambda architecture: a batch layer recomputes full results every 4 hours, a speed layer updates key metrics every 15 minutes, and a serving layer shows both. Keep daily intermediate datasets instead of reprocessing raw data.

Questions this case answers
  • How to compute experiment metrics for hundreds of concurrent tests within a fixed delay, when one daily incremental job makes every fix or rerun touch all tests
  • How to give near-real-time early readouts of experiments while keeping the full results accurate and recomputable
  • How to calculate metrics for 200+ concurrent A/B tests several times a day instead of once a day?
  • How to recalculate metrics for one faulty test without redoing every other test?

Tools and methods

  • Apache Spark — batch jobs, daily reconciliation and the streaming speed layer
  • Akka — actor pool running one Spark computation per test
  • Apache Kafka — real-time order and test-exposure data
  • Apache HDFS and Amazon S3 — date-partitioned storage (S3 since 2017)
  • Apache Hive — the first, incremental version
Continue reading — it's free

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