# Sampling Ad Exchange Events at Scale: What We Kept, What We Dropped, and Why

DevFeed: [Sampling Ad Exchange Events at Scale: What We Kept, What We Dropped, and Why](<https://devfeed.tech/articles/sampling-ad-exchange-events-at-scale-what-we-kept-what-we-dropped-and-why-112261.md>)

Original publisher: [Read original article](<https://hackernoon.com/sampling-ad-exchange-events-at-scale-what-we-kept-what-we-dropped-and-why?source=rss>)

Author: Vikrant Bachhav

Published: 2026-11-02T06:00:04Z

Content type: article

Language: en

Sources: [HackerNoon](<https://devfeed.tech/sources/hackernoon.md>)

Topics: [Big data infrastructure](<https://devfeed.tech/topics/big-data-infrastructure.md>), [Event-Streaming](<https://devfeed.tech/topics/event-streaming.md>), [Apache Spark](<https://devfeed.tech/topics/spark.md>), [Messaging](<https://devfeed.tech/topics/messaging.md>), [Grafana](<https://devfeed.tech/topics/grafana.md>)

Tags: [2019](<https://devfeed.tech/tags/2019.md>), [2022](<https://devfeed.tech/tags/2022.md>), [2023](<https://devfeed.tech/tags/2023.md>), [adtech](<https://devfeed.tech/tags/adtech.md>), [apache-kafka](<https://devfeed.tech/tags/apache-kafka.md>), [apache-spark](<https://devfeed.tech/tags/apache-spark.md>), [bi](<https://devfeed.tech/tags/bi.md>), [big-data](<https://devfeed.tech/tags/big-data.md>), [billing](<https://devfeed.tech/tags/billing.md>), [business](<https://devfeed.tech/tags/business.md>), [click](<https://devfeed.tech/tags/click.md>), [cloud-cost-optimization](<https://devfeed.tech/tags/cloud-cost-optimization.md>), [costs](<https://devfeed.tech/tags/costs.md>), [data-engineering](<https://devfeed.tech/tags/data-engineering.md>), [data-pipelines](<https://devfeed.tech/tags/data-pipelines.md>), [data-sampling-techniques](<https://devfeed.tech/tags/data-sampling-techniques.md>), [events](<https://devfeed.tech/tags/events.md>), [exchange](<https://devfeed.tech/tags/exchange.md>), [executor](<https://devfeed.tech/tags/executor.md>), [kafka](<https://devfeed.tech/tags/kafka.md>), [reporting](<https://devfeed.tech/tags/reporting.md>), [sampling](<https://devfeed.tech/tags/sampling.md>), [scale](<https://devfeed.tech/tags/scale.md>), [spark](<https://devfeed.tech/tags/spark.md>), [stream](<https://devfeed.tech/tags/stream.md>), [unity](<https://devfeed.tech/tags/unity.md>), [volume](<https://devfeed.tech/tags/volume.md>), [workers](<https://devfeed.tech/tags/workers.md>)

## AI overview

Unity reduced ad exchange stream volume from about 10 GB/s to 2 GB/s by sampling pre-filter events at 0.5% while retaining post-filter events at full fidelity. Sampling by auction ID kept related events joinable; counts from sampled data were scaled by the inverse sampling probability, while ratios remained comparable when both parts used the same sample. After reviewing reporting needs with report owners, the team moved reports to a separate sampled Kafka topic and tuned Spark executors. Worker count fell from 240 to 30 and CPU utilization rose 41%; DSP Report transform billing was about 41% lower for March 9-April 6, 2023 than the prior period. Two weeks of parallel comparisons preceded report cutover. Validation also uncovered longstanding join duplication that inflated BidWin and WinPrice metrics. The account notes that dimensions considered unsafe to sample were kept at full fidelity.

## Source excerpt

How we reduced Kafka stream volume by 80%, cut Spark workers from 240 to 30, and lowered reporting costs through sampling and executor tuning at Unity.