$10 left in the budget. 1,000 servers each approved a $20 bid.
transcript
An advertiser has 10 dollars of budget left. A moment later, you've spent 20,000 more.
A 10,000 dollar daily budget. 9,990 already spent. 1,000 requests arrive at once, each bidding 20 dollars. Every server sees 10 dollars left. All 1,000 approve. 29,990 dollars spent. 200 percent over.
Check one central budget on every bid? You have 100 milliseconds per request. A network call on every bid, on the hot path. Too slow.
Instead, a hierarchy. A global coordinator owns the 10,000 dollars. It splits it by region: 4,000, 3,500 and 2,000. And keeps 500 back. Each region leases its pods a small slice. Say, 100 dollars. The pod spends locally until the lease runs out. No network call per bid.
No lease left? Reject the bid, and refresh in the background. Leases last 30 seconds. Regions grant them with an atomic check-and-decrement. The leases never add up past the budget.
A region dies holding 4,000 dollars? Its leases expire within 30 seconds. Only provably unspent money moves elsewhere. The worst case is under-spending.
A slow request costs one bid. Overspend costs money the platform absorbs. So when in doubt, fail conservatively.
Full breakdown in the lecture.