Payments: The Hot Merchant Account
Hard · system design problem
A merchant goes viral: payments double and a third of them update one balance row. Then the fraud vendor browns out, and month-end reconciliation starts scanning the ledger. Every payment must be exact.
pay-api records each payment as ledger entries (CockroachDB, 12 nodes, entries spread across ranges), updates the merchant’s balance (a separate CockroachDB table, 6 nodes) and scores it with the fraud vendor. Merchants read dashboards; the reconciliation service scans the ledger in big batches. At T+20s a merchant goes viral: payments ×2 for the rest of the day, and 35% of balance updates are for that merchant’s row. At T+60s the fraud vendor browns out; an in-house fraud model (lower accuracy, 500 checks/s per instance, 10 instances) is deployed but unused. At T+120s month-end reconciliation starts (×20 for the rest of the day; each job scans a hundred ranges). Balances may lag by up to a minute (each entry is recorded immediately); reconciliation may run slower. The SLO counts payers and merchants.
Topics
More
Codelays runs in your browser: turn on JavaScript to use it.