Big Data for Ads
and the Real Cost of Latency
To switch things up a little, I thought I’d talk about a server-side aspect of Ads Performance for a change. If you do ads right, you can easily consume tons of data, perhaps even more than the rest of your company combined. That and there are real demands for real-time on the ads side of things; you want responsive user targeting, to know whether a particular campaign is performing, or whether you’ve suddenly and dramatically lost revenue. How do you drink from this firehose of data, and do it in a way that is both accurate and cost-efficient?
Introducing Publish/Subscribe for Microservices
Everyone loves to reach for microservices, but in practice implementing them at your company can be an uphill battle. More than likely, it’s just that you’re missing one crucial piece.
Last week I talked about event-driven systems. In contrast to typical REST systems, that are stateless and require “pulling” data at a client’s request, event-driven systems “push” data to services that consume them.
This model is incredibly useful in high throughput real-time systems, largely due to the dependency inversion I discuss in the article linked above. As Tim Burglund demonstrates in his Apache Kafka video, having a push model and stateful log naturally begets the microservices model. Suddenly, microservices can be a natural consequence of engineers leveraging a particularly useful piece in their architecture stack, not something that needs to be constantly enforced.
But crucially this also facilitates a particular degree of statefulness amongst distributed systems. In addition to the raw event log Kafka automatically records, this also enables us to run real-time aggregate jobs at scale, which are highly useful for ads metrics.
The Real Cost of Latency
At high scale, the real cost is not individual message latency, but how efficiently a system can process large volumes of events. Architectures that support batching and parallel consumption can sustain far higher throughput with less infrastructure.
Log-based systems like Kafka are designed to process events in large batches, which reduces per-event overhead and allows real-time pipelines to scale efficiently. Systems that emphasize per-message delivery and acknowledgements can require more concurrent consumers to keep up as volume grows, increasing operational cost.
Conclusion
Running a successful ads business necessitates highly accurate real-time metrics at scale. The technology is there, and it’s open source. Adopting these technologies for the revenue side of the business is also a perfect moment for revenue teams to lead great architecture decisions company-wide.

