Capacity Planning
Design a system that moves money: a payer is charged, a payee is credited, and the balances are always right — even though every step runs over networks that fail, and an external payment provider (a card network, a bank) that cannot participate in your database transaction.
In scope: initiating a payment, executing it through an external provider, recording every money movement in an auditable ledger, exposing balances and payment status, and refunding or voiding a payment. Fraud detection, the provider's own internals, and pricing/fee calculation are out of scope.
Scale and usage:
Assume roughly 10,000 payments a second at peak — illustrative, modest next to a high-QPS analytics or ad system.
2.2 Ledger writes
Double-entry accounting means every payment writes at least two ledger rows: 10,000 × 2 = 20,000 ledger writes a second at minimum — comfortably within a sharded, transactional store.
2.3 Storage and reconciliation
A payment record and its ledger entries are well under a kilobyte combined; the entire ledger stays small next to any media or event-log system. The daily reconciliation batch re-checks every payment against the provider's settlement file, sized by daily payment count — hundreds of millions of rows a day if the assumed peak rate were sustained, and still a routine batch scan, not a real-time concern.
Key idea. Payment volume itself is modest; the design optimizes for correctness under failure, not for absorbing a high write rate.
What a strong answer sounds like
State the decision, connect it to a requirement, and name the tradeoff. Ask the interviewer for any product facts you need (users, usage, scale, targets) — they will answer. Keep the design focused on the workload.
The AI interviewer asks about this part of Design a Payment System. The interviewer guides you through topics one by one.