Insights
Platforms & Infrastructure 2 Nov 2026

Holding p95 Under 80ms at 3-4M Bid Requests a Day

Real-time bidding gives you well under 100ms to answer or you don't take part in the auction. Here is where the time went on an ad platform answering in ~340ms and the changes that brought it under 60ms at peak.

The Budget Is Not Negotiable

Most latency targets are aspirations. In real-time bidding they are a hard cutoff. An exchange sends a bid request, waits a fixed window and runs the auction with whatever answers arrived. A bid that lands late isn't a slow bid. It isn't a bid at all and the impression goes to someone else.

When we took on full-stack engineering for act.ad, the platform needed to grow from tens of thousands of ad requests a day to millions while staying inside a sub-100ms response window. At the start, responses at peak load were around 340ms. Today the platform sustains 3-4 million requests a day with p95 bid responses under 80ms.

None of the changes were exotic. Most of them came down to one question asked over and over: what is this request waiting for and does it have to?

Where the Time Was Going

Three things were slowing the request path down and only one of them looked like a bidding problem.

  1. A monolith under concurrency. Auction handling, bid evaluation and everything else shared one service. Under concurrent auction load, requests queued behind each other and response times degraded with traffic.
  2. Writes on the hot path. Every impression, click and conversion was written straight to PostgreSQL inside the request. That's fine at low volume. Under load, the database becomes part of the bid latency.
  3. Reporting contention. Reporting-heavy periods put the same database under analytical load and the latency spikes showed up in bid responses that had nothing to do with reporting.

The third one is the instructive one. If reporting can slow down bidding, the two share a resource they shouldn't.

Take Every Write Off the Request Path

The single biggest structural change was to stop writing events synchronously. Events now go to a Redis Stream: an append is fast and doesn't wait on the database. A consumer group drains the stream in batches into PostgreSQL. A second consumer feeds ClickHouse, which answers the reporting queries.

That one change separated three workloads that had been fighting each other: answering bids, storing events and querying them. Reporting can now be as heavy as publishers need without touching bid latency.

The trade-off is that reporting becomes eventually consistent. A publisher's dashboard is seconds behind reality rather than exact to the request. For reporting that's the right trade. For anything that gates a bid, it isn't, which is why budgets are handled differently (below).

Make the Bidder Stateless and Keep CPU Work Off the Event Loop

We rebuilt bidding as a stateless Koa service. Stateless means any instance can answer any request, so capacity scales by adding instances rather than by tuning one big process.

Node.js handles I/O concurrency well, but CPU-bound work blocks its event loop and a blocked event loop delays every other request on that process. Bid evaluation is CPU work: scoring eligible campaigns against the request. So it runs on worker threads, leaving the main thread free to accept and route requests.

A Pipeline With Nothing Slow In It

Every auction request now goes through four steps:

  1. Validate the request and authenticate the publisher.
  2. Check budget eligibility against a Redis cache, not the database. Campaigns that can't spend drop out before any scoring happens.
  3. Evaluate bids in parallel across the eligible campaigns.
  4. Select the winner and log it, where "log" means append to the stream, not a database write.

The design rule behind it: everything a bid waits on should be in memory or computable on the spot. Redis also handles rate limiting, so abusive or misconfigured traffic is turned away cheaply, before it costs evaluation time.

A cache in front of budgets raises an obvious question: how stale can a budget be before you overspend? There is no universal answer. Decide how much potential overspend is acceptable, then set how budget state is refreshed to match that number, rather than reaching for strong consistency the bid window can't afford.

Measure the Tail, Not the Average

Average latency is the wrong number for an auction. If the average is 40ms and one request in twenty takes 150ms, then one bid in twenty never takes part and the average hides it completely. We track p95 because that's the share of auctions you're willing to lose to latency, said plainly.

The tail is also where contention shows up first. Reporting load, garbage-collection pauses and a busy event loop all show as tail spikes long before they move the mean.

Kafka Was the Obvious Choice and Not the Right One Yet

We evaluated Kafka for the event queue and chose Redis Streams. At around 4 million events a day, the operational cost of running a Kafka cluster wasn't justified. Redis was already in the stack for bid caching, so streams added no new infrastructure to operate.

The design is deliberately ready for that migration: producers and consumers sit behind the same append-and-drain interface. If volume grows by an order of magnitude, swapping the transport is contained work rather than a rewrite.

What It Bought

Peak response time went from around 340ms to under 60ms. The platform sustains 3-4M requests a day at p95 under 80ms. Fill rate rose 14%, part of which we attribute to faster responses making the platform competitive in more auctions. That attribution is partial and we'd rather say so than claim all of it.

The lesson generalises beyond ad tech. When a system has a hard latency budget, list everything the request waits on, then move everything that doesn't have to happen now somewhere else.