Real-Time Ledger Systems: Optimistic Locking in a Double-Entry Ledger

Optimistic Locking in a Double-Entry Ledger &#xA; Ledgers are a deceptively simple problem to tackle. At a certain scale, leveraging a simple&#xA; SELECT FOR UPDATE works perfectly well—wrap everything in a transaction, and move on. &#xA; But the moment you need concurrent writes to the same accounts, hundreds of transactions per second,&#xA;and real-time balance consistency—everything changes.…