System design

Expert

Exactly-once at 8,000 transfers per second

A payments app processes peer-to-peer transfers asynchronously. The team picked a FIFO queue for its exactly-once guarantee, but at 8,000 transfers per second the API is now being throttled. Apply every transfer exactly once, keep up with the flow and stay within a monthly budget of 22,000 dollars.

A FIFO queue accepts about 3,000 messages per second. Standard queues and event logs deliver at least once, so a message can arrive twice. Transfers of one account must stay in order. Queues are billed per message, logs per partition and broker. The ledger is fixed: change what feeds it.

What your design must achieve

  • Duplicated side effects = 0
  • Availability ≥ 99.9 %
  • Worst queue lag < 60 s
  • Writes p99 < 150 ms
  • Monthly bill < 22,000 $

What you will master