axdev
AdTechHigh-loadRTB

Ad network with its own real‑time auction

An ad network for web traffic: auction, budget pacing, fraud filtering, and dashboards for advertisers and publishers. Peaks of up to 60,000 requests per second.

requests per second at production peak
60,000
requests per second at production peak
requests per second — estimated capacity when scaled out
up to 100,000
requests per second — estimated capacity when scaled out
engineer for the whole platform: more than 15 services and apps
1
engineer for the whole platform: more than 15 services and apps
Kubernetes clusters on different providers
2
Kubernetes clusters on different providers

A self‑serve ad network: advertisers launch their own campaigns, and publisher websites monetize their traffic. The network sells popunder, in‑page, and web push impressions, and buys traffic from partner SSPs. Advertisers pay per impression or per click, and conversion‑based optimization is available.

One of our engineers built and continues to develop the entire platform with AI agents: the auction, pacing, accounting and billing, fraud filtering, moderation, the advertiser and publisher dashboards, the JS SDK for publisher websites, and infrastructure across two clusters.

The auction

The bidder is written in Go and handles ad requests for every channel. Each auction combines internal campaigns served from a cache with external DSP bids. External feeds sit behind circuit breakers, QPS tracking, and a DNS cache, so one slow partner cannot hold up the whole auction. When answering a partner SSP, the bidder works from its tmax and reserves time for the network and post‑auction work. Creatives are chosen by a bandit algorithm: most impressions go to the best performer, and the rest test new variants.

At peak, the bidder handled 60,000 requests per second. Each request costs about 0.77 ms of CPU time, and the service keeps no state between requests, so capacity grows by adding pods. In load testing, 24 pods sustained 31,800 requests per second. Based on these measurements, the current architecture can handle roughly 100,000 requests per second without redesign.

Budgets and accounting

An advertiser’s money must never be spent twice, and a campaign with a daily cap should spend it evenly across the day. A separate pacing service handles this: a single leader replica, elected through Valkey, publishes campaign state to Kafka every second. On CPC campaigns a click can arrive well after the impression, so the pacer estimates clicks that are still to come from the CTR and keeps the campaign within its remaining wallet balance.

Impression and click events flow through Kafka into a Go consumer. It charges campaigns, drops duplicates, and writes facts to ClickHouse for reporting. This work used to be done by a PHP consumer; the Go version now handles all of it.

Tracking links are HMAC‑signed and carry an encrypted snapshot of the bid. The service no longer has to store state for every impression, and the separate database for that is gone. Impressions are counted by sampling, and billing compensates using the sample weight.

Fraud and moderation

Clicks go through Cloudflare Workers. An edge check page compares the IP, User‑Agent, and client hints, uses Cloudflare’s bot signals, and blocks data center and proxy traffic. Placements that send bad traffic are blacklisted automatically. Edge tracking was launched on separate subdomains alongside the old hosts, so rolling back took a single configuration change.

Advertiser landing pages are checked by a Playwright crawler. It follows the redirect chain, screenshots every step, and detects cloaking and sign‑up forms. The crawler only collects evidence; the API makes the decision. Tests and a lint rule make sure it never fills in or submits a form on someone else’s site.

Infrastructure

The services run in two Kubernetes clusters on different providers, with traffic split between them. Builds run in Jenkins, deployments use Helm, secrets live in Vault, and MySQL reads go to replicas through ProxySQL. The advertiser and publisher dashboards are built with Next.js; the API, billing, and CRM use PHP Symfony.