Catalogue / moderntreasury-2024-ledgers-throughput

Modern Treasury's Ledgers API caches balances in Postgres, batches hot-account entries through SQS and serves customers from cells

Modern Treasury, 2024. Ledgers, a double-entry ledger API.

Organisation
Modern Treasury
Evidence
Reported from production
Source
Behind the Scenes: How We Built Ledgers for High Throughput

Modern Treasury Journal, published 2024-01-25

Records

Decision#d1

Cache every account balance so reads are constant time and balance locks can use row-level locking

Decision#d2

Let each entry choose synchronous locked processing or asynchronous batching, to relieve hot accounts

Decision#d3

Serve customers from cells, each a full deployment, so capacity grows with customer count and can be tuned per customer

Decision#d4

Run peak load tests at least quarterly, shaped on real customer traffic and prospects' requirements

Decision#d5

Serve list queries from indexes on auto-scaling read replicas

Sign in to read what was chosen, what was rejected and what it cost, each with its place in the source. An account is free. The job-queue cards are open without one.