Journey of an Ad Request: The Hidden Engineering Advertising is a key source of revenue in most businesses. It certainly forms a key pillar for JioHotstar. There is so much technology hidden under the surface. In this blog, we will cover some of the complexity that gets unlocked when we render an ad on our content. Every 30-second ad break is a high-stakes performance involving millions of calculations, real-time bidding, and surgical precision. When you open JioHotstar to watch a live sports event or simply a movie, you see a<span> </span>Fence*<span> </span>ad (static display) or a<span> </span>Preroll*<span> </span>or a<span> </span>Midroll* Ad<span> </span>(video). What you don’t see is the “Ad Decision” engine firing at millisecond speeds to decide:<span> </span>Why this ad? Why now? And why you? Speak Like an Adtech Pro Getting your foot inside the door, we need to understand some jargon! Some common Ad Formats on JioHotstar Preroll Ad: The video ad you see before the actual content video starts. Midroll Ad:<span> </span>The video ad you see while in between the content. Fence Ad: The static display ad you see below the player on the app. The Demand Puzzle Imagine you’re at your local market where you see two establishments side-by-side: Both want to run ads, but their goals, scale, targeting strategy, and optimization signals are fundamentally different. One is optimizing for reach[how many different types of customers saw it] and visibility[how many unique geographies was this seen in] at national scale. The other is optimizing for precision, locality, and more measurable performance. Our system must juggle thousands of these conflicting demands simultaneously. This leads us to the ultimate engineering challenge:<span> </span>The Selection. Zeroing In: The Ad Decision Logic How do we pick 2–3 ads out of thousands for a 30-second ad “pod”? At JioHotstar, we use a very intricate implementation of waterfall tiers approach mixed with our<span> </span><a class="as kf" href="https://arxiv.org/pdf/1905.10928">PID</a><span> </span>and<span> </span><a class="as kf" href="https://research.google/pubs/shale-an-efficient-algorithm-for-allocation-of-guaranteed-display-advertising-2/">SHALE</a><span> </span>pacing algorithms. These calculations are all performed and delivered in under 100ms, even during massive concurrency spikes like the final over of an IPL match. <span class="be bf bg i bh bi bj bk bl speechify-ignore">Press enter or click to view image in full size</span> A sample of the throughput spikes on the adserver that we get during a cricket match During the Live sports events, the ads services get a very spiky traffic giving little to no time for the services to react to organic scale-up if we are not prepared in advance. The peaks are observed during ad breaks while the API traffic becomes more predictable and lower during the innings break(20:40 hrs — 21:10 hrs) as we see it in the graph above.