How Roblox Used Theta Sketches to Scale Creator Analytics

Willis Kennedy15 Apr 2025

Problem

Roblox gives its creators a free dashboard with daily and monthly active users (DAU, MAU), retention, funnels and revenue. Distinct counts resist rollups, because they need a full pass over raw data. The worst case is MAU for a popular experience, a distinct count over more than 100 million user IDs, which can stretch load time from seconds to minutes. The target was a two-second latency for creators at scale.

Example from the article: a 120-core cluster serves more than 6 million queries per day from about 300,000 daily visitors reading 86 TB of data.

Solution in brief

Store a mergeable sketch (HyperLogLog or Theta) per rollup group in an OLAP database, so a distinct count becomes a union of small objects. Keep the sketch merge on the data nodes instead of the broker, with an inline join over result dates. Use a low-dimension rollup replica for typical queries.

Questions this case answers
  • How to serve unique-user counts over rolling windows with interactive latency when raw event tables are too large to scan per query
  • How to avoid a coordinator-node bottleneck when a distributed query engine must union many large probabilistic sketches per result row
  • How to serve distinct-count metrics such as MAU in a self-serve dashboard within about two seconds over tens of terabytes of events
  • How to stop a merge of millions of sketches from overloading the query coordinator in an OLAP cluster

Tools and methods

  • Apache Druid — OLAP store with columnar storage, partition and sort filters, and rollup.
  • HyperLogLog and Theta sketches — approximate distinct counts that merge by union.
  • Inline join over result dates — keeps per-day sketch merges on historical nodes.
  • Spark and Trino UDAF library — writes sketches in the same binary format as the OLAP.
Continue reading — it's free

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