HLD-304·Payments & Ledger
Hard · 1,500 ptsReal-Time Ad Click Attribution & Budget Pacing
Design an ad-tech click ingestion and real-time campaign spend-pacing pipeline preventing exhausted ad budgets from continuing to serve billable impressions.
Max p99
≤ 50 ms
Availability
≥ 99.5%
Budget
≤ $6,000
Functional Requirements
- FR-1POST /v1/clicks — Deduplicates click_id events and increments live campaign spend.
- FR-2GET /v1/campaigns/{campaign_id}/budget — Checked by ad-serving bidders before auction participation.
- FR-3POST /v1/clicks/{campaign_id}/reverse — Supports idempotent reversal/refund or campaign pause updates while keeping cached balances and deduplication keys consistent.
- FR-4Depleted campaign budgets must immediately reflect in pacing reads (read-after-write) even during storage brownouts.
Workload Profile
Baseline Auctions38,000 Pacing Read RPS / 16,000 Click Write RPS
Halftime Ad Flood95,000 Read RPS / 46,000 Click Write RPS
Active Working Set26 GB click dedup window & campaign budgets
Fault Scenario7x attribution storage tail-latency brownout in Wave 3
Consistency Model
Read-after-write budget visibility required so bidders stop serving paused/exhausted campaigns within seconds.
Solutions Locked
Sign in and either achieve AC or complete 3 official submissions on this question to inspect community diagrams and writeups.
Loading solutions...
Submission History (0)Select to replay
No submissions yet
Click Submit in the top bar to evaluate against all 7 judge cases and save each run here.
Design Write-up
0 boxes · 0 edges
0 words