In programmatic advertising, every millisecond counts, and so does every fraction of a cent it costs to process a bid. When a publisher makes an ad opportunity available, a demand-side platform (DSP) has a few milliseconds to decide whether to bid, how much, and on whose behalf. The Trade Desk runs that decision engine on Amazon Web Services (AWS) at enormous scale. In this post, we explore how The Trade Desk holds the line on unit cost (the infrastructure cost to process each bid and serve each impression) without touching that millisecond budget. We also show how they moved from periodic manual cost audits to a continuous, agent-driven investigation loop that maps spend to business workloads.

A hot path that cannot wait

The Trade Desk is a DSP, the technology that advertisers and their agencies use to buy media programmatically across the open internet, including display, connected TV (CTV), audio, and digital out-of-home. Every campaign reduces to the same mechanic at massive scale. A supply partner sends a bid request, and in the milliseconds before the content loads, the platform decides whether to bid, how much, and for which advertiser.

Real-time bidding (RTB) is a form of programmatic advertising that allows for the buying and selling of digital ads in real time. When users go to a website or mobile app, a real-time auction is conducted where advertisers bid and compete for an ad space. If the advertiser has the highest bid in the auction, their ad is displayed on a publisher’s website or mobile app.

That split defines the rest of this story. A synchronous, in-memory hot path must be fast and correct in the moment. The asynchronous systems around it can afford to be slower and cheaper, and they hold most of the room to optimize.

Figure 1 – The Trade Desk real-time bidder (DSP) architecture on AWS, with an in-memory RTB hot path and an asynchronous, log-based data pipeline (Amazon S3 and Apache Spark on Amazon EMR). Aerospike runs on Amazon EC2 x86 r-series instances with NVMe instance store.

Measuring unit cost, not the absolute bill

At this scale, absolute infrastructure spend always rises with volume, so the total bill tells you little. A bigger bill can simply mean a bigger business. What matters is unit cost, and for a DSP there are two complementary views:

  • Cost per thousand impressions served. This is an infrastructure cost-to-serve figure, distinct from the media CPM (cost per mille) that advertisers pay. It measures what infrastructure costs to deliver a thousand impressions, not what the media is bought for.
  • Cost per million bid requests processed (cost-per-bid). This is the infrastructure-native unit for a DSP, because the platform is billed for the compute and data movement of every bid it evaluates, including the ones it loses. A dropped bid still consumes real infrastructure.

That distinction is what makes the problem for an agent. When the agent is fed unit cost mapped to the workload that produced it, it can tell a genuine regression, such as cost per thousand impressions rising while volume stays flat, from cost that simply tracks a growing business.

One hard constraint shapes the work. Nothing on the hot path can add latency or change bidding behavior, no matter the savings, so you can’t shrink the fleet that answers every auction in milliseconds. Instead, the work concentrates on the asynchronous systems, storage layers, and networking paths around it, which drive real cost per bid and per impression at scale.

From manual audits to an agentic approach

For a long time, cost work meant periodic manual audits. An engineer picks a service, pulls a cost report, and looks for anomalies. That doesn’t scale, and unit-cost regressions sit undiscovered between audits.

So the approach changed, built from an internal Cloud Cost MCP server and the AWS DevOps Agent. The Cloud Cost MCP server exposes The Trade Desk’s AWS Cost and Usage Report (CUR) data as tools an agent can call directly, such as cost by service, cost by resource, and month-over-month usage trends. The AWS DevOps Agent supplies operational context. It reads those signals, forms hypotheses, and validates changes against how the workload behaves, which turns cost investigation from a slow manual pull into something continuous.

The heart of it is a workload-to-cost mapping agent. It ingests month-over-month CUR data, maps each line of spend to the workload that generated it, and correlates the cost pattern against the workload-change pattern (impression volume, bid-request throughput, and deployment events). It then flags where the two diverge. Cost rising without a matching volume increase is a unit-cost anomaly, and that is what the agent surfaces for validation.

From there, the agent validates concrete optimization levers against real workload behavior before anything changes.

  • Compute-generation migration: Moving instances to a newer generation, and where the workload allows, evaluating a move from x86 to AWS Graviton for better price-performance. Each move is validated against the workload’s actual CPU and memory profile.
  • Storage-tier moves: Shifting objects out of full-price tiers into the tier that matches real access patterns, validated against retrieval behavior.
  • Data-transfer pattern changes: Rerouting high-volume traffic off costlier paths, such as a NAT gateway, onto cheaper ones such as VPC endpoints, validated against where the bytes actually flow.

The method matters as much as the tooling. Map every line of CUR spend to its workload, correlate cost against workload change, and then validate the lever against production behavior before a human approves it. Mapping without correlation just relabels the bill, and correlation without validation produces changes that look good on a chart and hurt in production.

The findings that mattered most were the ones a summary view is blind to. Amazon Simple Storage Service (Amazon S3) is the clearest example. Every summary signal looked healthy, with spend growing in line with volume and a lifecycle rule in place.

In effect, this loop is a continuous AWS Well-Architected Framework review scoped to the Cost Optimization pillar, run by software instead of on a calendar. As with any Well-Architected review, a human validates the findings before action.

What the agent found

Pointing the loop at the AWS estate produced a working list of concrete findings, each framed by its effect on unit cost:

  • Amazon S3 storage tiering: Beneath a lifecycle rule that swept only new writes, the agent found a large multi-year backlog in full-price S3 Standard across multiple buckets, inflating cost per stored object. Zero-risk tier moves are rolling out, and related bucket cleanup has already realized ongoing savings.
  • AWS Config: Recording cost roughly doubled in two months. The cause was Kubernetes pod and network-interface churn generating tens of millions of configuration items per day. The fix moves from continuous to scheduled recording and narrows tracked resource types.
  • NAT gateway data transfer: High-volume traffic to AWS services was routed through a NAT gateway instead of VPC endpoints. The routing change shipped, and the full effect confirms in the next billing cycle.
  • Amazon Elastic Block Store (Amazon EBS): Stale, orphaned snapshots accrued cost with no owning workload. Cleanup shipped, and the detection pattern now catches these automatically.
  • Compute generation: The fleet currently runs on x86 instances. Newer generations, and AWS Graviton where the workload allows, offer better price-performance. A migration is being evaluated against the workload’s CPU and memory profile, and no move has been made yet.
  • Elastic Load Balancing: A load-balancer architecture change to lower per-request cost is being sized.

A repeatable framework

None of these findings lived in isolation. Moving Amazon S3 data into the right tier changes egress patterns, modifying NAT gateway routing changes what AWS Config records, and a compute-generation migration changes both cost and performance. Interconnected workloads are exactly why a point-in-time audit under-serves an estate this large. For any AdTech company operating at high bid volumes, the agent-driven framework has four parts.

  1. Optimize for unit cost, not the absolute bill. Track cost per million bid requests and per thousand impressions served, because a growing bill can just mean a growing business.
  2. Feed the agent month-over-month CUR data mapped to workloads. Then correlate cost against workload change. Raw totals hide regressions, and cost that rises without matching volume is the anomaly worth chasing.
  3. Protect the hot path completely. No optimization that adds latency or changes bidding behavior is worth the savings.
  4. Point a continuous, agent-driven loop at everything else, and validate each lever against real workload behavior before it ships. At this scale, the opportunities don’t announce themselves, and they don’t stay found once someone stops looking.

Conclusion

The Trade Desk’s move from AI-assisted cost audits to an agentic, workload-aware investigation loop shows how a DSP can manage cost per bid and per impression as a continuous program while protecting real-time performance. By pairing an internal Cloud Cost MCP server over their CUR data with the AWS DevOps Agent, they turned unit-cost optimization into something that runs across the whole estate, all the time. That positions The Trade Desk to consistently capture the per-bid savings that manual review misses.

Further reading