Re-architecting a payments platform for 50k rps
A ledger and gateway rebuild that took a strained monolith to 50,000 requests per second with money-grade correctness.
## The challenge
The existing payments monolith buckled every peak. Lock contention on the ledger meant timeouts, retries and the occasional double charge — the kind of bug that erodes trust fast.
## What we did
- Split the ledger into an append-only, double-entry core with idempotency keys end to end.
- Moved settlement and notifications onto Kafka, decoupling write paths from slow downstream work.
- Introduced partitioned Postgres with careful index design and a tuned connection pool.
- Wrapped everything in load tests that replayed real production traffic shapes.
## Outcome
The platform now sustains 50k rps with a p99 two-thirds lower than before — and not a single reconciliation mismatch since launch.