Integrating external SSPs increases traffic and revenue. But rising revenue does not mean rising profit.
When an ad request arrives, the recommendation server generates ad candidates and the filtering server removes unsuitable ads. Media fees are paid to the external SSP for each impression. Add the server costs for these processing steps to the media fees, and some inventories cost more than they earn. As server cost share grew, contribution margin was shrinking.
The decision was to build a system that automatically identifies low-performing inventory and throttles its traffic.
Performance Metric Analysis
Determining which inventories underperform required clear criteria. Three candidates were analyzed.
Imp Cost Ratio. The ratio of media cost to revenue. Above 100% means media cost exceeds revenue — a net loss from the contribution margin perspective, even if revenue is generated. This was the most intuitive metric.
RPM. Revenue per 1,000 impressions. Some inventories had low RPM but were still profitable. Lower priority than Imp Cost Ratio. In practice, Imp Cost Ratio alone produced enough throttling candidates, so RPM was excluded.
Win Ratio. The proportion of SSP bids won. A low Win Ratio means ads are prepared but never served — server resources consumed with no revenue generated. Useful as a supplementary metric for server cost reduction.
Imp Cost Ratio was set as the primary criterion, with Win Ratio as a secondary supplement.
First Approach
How to throttle traffic for inventories with Imp Cost Ratio above 100% was examined.
Two methods were compared. The first applied weighted throttling based on Imp Cost Ratio and impression share — higher ratio and higher impression volume meant more aggressive throttling. The second applied a fixed throttling rate to all target inventories. Simple but reliable.
Both methods were simulated in Redash. The simulation showed traffic decreasing for inventories where media cost exceeded revenue.
But the approach was not applied. A limitation surfaced through discussion. The project goal was contribution margin improvement, while Imp Cost Ratio only reflects media cost. It ignores server costs. Some inventories were profitable by media cost alone but unprofitable when server costs were included. The full picture of contribution margin was missing.
Second Approach
A comprehensive profitability metric that included server costs was needed. A predicted contribution margin rate was introduced.
Measuring server cost per inventory directly is difficult. The approach was to allocate by impression-based contribution.
From this, revenue and cost items are combined to calculate a predicted contribution margin rate. A negative value means the inventory is losing money from a contribution margin perspective.
Throttle Rate Calculation
The contribution margin rate needed to be converted into a traffic throttle rate. Several functions were compared.
Functions that react sharply at the early stage were deemed too aggressive. The goal was to improve contribution margin while minimizing revenue impact, so a graduated correction shape was chosen. The threshold was made configurable externally, allowing flexible control over the scope of throttled inventories.
Batch Architecture
Server cost data is aggregated daily, so the batch runs on a daily cycle.
Per-inventory ad performance (impressions, media cost, revenue) is queried. Per-service server costs are queried. The two datasets are combined to calculate per-inventory predicted contribution margin rate, derive the throttle rate, and store it in the database. The ad server references each inventory’s throttle rate when handling incoming requests.
Revenue alone hides important details. Recognizing that revenue was rising while profit was falling was the starting point.
The first approach looked only at media cost. The simulation looked promising, but server costs were missing. It was not applied; the second approach took over, incorporating server costs and revealing the full contribution margin picture. Catching the gap between metric and goal before any rollout — and advancing the approach by a step — was the most valuable learning from this project.
Contribution margin improved meaningfully.