When you load a web page, an auction happens in under 100 milliseconds to decide which ad you see. A publisher sends a bid request to an ad exchange. The exchange fans it out to dozens of demand-side platforms (DSPs). Each DSP decides whether to bid and at what price. The exchange picks the winner. All of this completes before the page finishes loading. Real-time bidding (RTB) is one of the most latency-sensitive distributed systems in production.

The Auction Flow#

The critical constraint: the full round-trip from bid request to winning bid must complete in 100ms. The exchange allows 80ms for DSPs to respond. DSPs that respond after the deadline are excluded from the auction. The latency budget is the hardest constraint in the system.

A DSP receiving a bid request must: look up the user profile, check campaign targeting criteria against the user, apply frequency capping (don’t show this ad to this user more than 3 times today), compute the bid price, and return a response. All of this in under 80ms, at potentially 500,000 bid requests per second.

graph TD A[User loads page: ad slot available] --> B[Publisher sends bid request to ad exchange] B --> C[Exchange fans out to 30+ DSPs simultaneously] C --> D[DSP: user lookup, targeting check, frequency cap, bid price] D --> E{Response within 80ms?} E --> |Yes| F[Bid submitted to exchange] E --> |No| G[Excluded from auction] F --> H[Exchange runs second-price auction] H --> I[Winner pays second-highest bid + $0.01] style A fill:#000000,stroke:#00ff00,stroke-width:2px,color:#fff style B fill:#000000,stroke:#00ff00,stroke-width:2px,color:#fff style C fill:#000000,stroke:#00ff00,stroke-width:2px,color:#fff style D fill:#000000,stroke:#00ff00,stroke-width:2px,color:#fff style E fill:#000000,stroke:#00ff00,stroke-width:2px,color:#fff style F fill:#000000,stroke:#00ff00,stroke-width:2px,color:#fff style G fill:#000000,stroke:#00ff00,stroke-width:2px,color:#fff style H fill:#000000,stroke:#00ff00,stroke-width:2px,color:#fff style I fill:#000000,stroke:#00ff00,stroke-width:2px,color:#fff

The User Profile Store#

The user lookup is the most latency-sensitive read. User profiles (demographics, interests, behavioral signals) must be in memory. A single Redis read at sub-millisecond latency is the baseline. User profiles are large (hundreds of features) so the read budget is 1-2ms.

At DSP scale, user profile data is distributed across data centers. The bid request arrives at the closest data center. If the user profile is in a different region, cross-region reads add 30-50ms, which blows the latency budget. Solution: replicate user profiles to all regions. Write latency is acceptable; read latency is not.

Second-Price Auctions#

Most RTB exchanges use second-price (Vickrey) auctions: the winner pays the second-highest bid plus one cent, not their own bid. This incentivizes honest bidding: your optimal strategy is to bid your true value, not to shade your bid trying to win cheaply. A DSP bidding $2.00 when a competitor bids $1.50 pays $1.51, not $2.00.

Tail Latency Problems#

At 500,000 bid requests per second, p99 latency matters more than mean latency. A DSP with 70ms mean latency but 120ms p99 latency misses 1% of auctions. 1% of 500,000 = 5,000 lost auctions per second. Tail latency in RTB directly translates to lost revenue.

At Oracle#

Oracle Data Cloud was a DSP participating in RTB auctions. The user profile lookup was the critical path. We pre-warmed the cache for high-match user segments at the start of each day. Cold-cache lookup (user not in Redis) fell back to a database read at 15ms — fast enough to still respond within 80ms, but contributing to p99 tail latency. Monitoring the p99 of cold-cache lookups was the primary operational metric.

What I’m Learning#

RTB is an extreme case of the latency-sensitive distributed system: the timeout is external and non-negotiable, the read path must be entirely in-memory, and tail latency directly costs money. Designing for the p99 rather than the mean is the right frame for this class of problem.

What systems have you worked on where missing a latency deadline had immediate business consequences?