Knowledgebase

Handling Concurrency and Consistency Print

  • fintechpaymentsystems, fintech, performance, guide, howto, solution, zillionkinghost, hosting
  • 0

Correctness under load.

WHAT THE RISKS ARE

Double spending from concurrent requests Balances read before another transaction commits Duplicate processing of the same event

WHAT PREVENTS DOUBLE SPENDING

Locking the balance row during the transaction A constraint preventing negative balances Serialised processing per account

WHY A CHECK-THEN-ACT PATTERN FAILS

Two requests both read a sufficient balance before either writes.

WHAT ISOLATION LEVELS AFFECT

Which anomalies are possible.

WHAT TO USE FOR MONEY

An isolation level preventing the anomalies that matter, understood rather than assumed.

WHAT OPTIMISTIC CONCURRENCY PROVIDES

Detecting conflict at write time, and retrying.

WHERE IT SUITS

Low-contention accounts.

WHERE IT DOES NOT

Accounts with heavy concurrent activity.

WHAT EVENTUAL CONSISTENCY MEANS

Reads may be stale briefly.

WHERE THAT IS ACCEPTABLE

Reporting and analytics.

WHERE IT IS NOT

Balance checks before a debit.

WHAT TO TEST

Concurrent operations on the same account, deliberately, at volume.

WHY

These defects do not appear in sequential testing and are catastrophic in production.

WHAT TO MONITOR

Negative balances, which should be impossible.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot