Distributed Transactions: Why You Probably Do Not Need One

D
Dick Edidiong Bassey
·

Distributed transactions are one of the hardest problems in software engineering. Before implementing one, ask: can I restructure this operation to avoid crossing service boundaries atomically?

Most operations that appear to require distributed transactions can be redesigned: "debit account A and credit account B" can be replaced with "create a transfer record in a single service that owns both accounts."

When distributed transactions are genuinely necessary, the saga pattern is more practical than two-phase commit: define compensating transactions for each step, execute in sequence, and on failure, execute compensating transactions in reverse order.

Design your service boundaries to minimise cross-service transactional requirements. It is easier to design them away than to implement them correctly.

— Dick Bassey | DevDick | 2025