Account model vs coin model

In the account model, each payment updates one balance row, so all payments for one merchant wait in line. In the coin model, each payment adds its own output, and writes do not conflict. At 4,000 payments/s to one merchant, the account model fails 79 percent. The coin model gives p99 26 ms.

Play the level

Account model, one balance rowTap or press Space to change the money model

Account model · writes that wait for one row: 1,500 more each second

Coin model, one output per paymentTap or press Space to change the money model

Coin model · writes that wait for one row: 0 more each second

Case 1

Card payments settle into one merchant at 4,000 payments/s. p99 must stay below 100 ms. The merchant reads its balance 20 times/s and needs a value at most 5 s old.

Case 1
Measure Goal Account model, one balance row Coin model, one output per payment
p99 latency (Payments) under 100 ms 10.1 s Fail 26 ms Pass
Error rate (Payments) under 0.1% 79% Fail 0% Pass
Data age under 5 s 0 ms Pass 1 s Pass
Monthly cost 16 USD/mo 16 USD/mo
SQLSQLUsersPartner appsPostgres4 vCPU · 4 GB
SQLSQLUsersPartner appsPostgres4 vCPU · 4 GB
Account model, one balance row: misses a goal
SQLSQLUsersPartner appsPostgres4 vCPU · 4 GB
SQLSQLUsersPartner appsPostgres4 vCPU · 4 GB
Coin model, one output per payment: meets the goals