Learning · Software Engineering Manifesto
Do not hold transactions across the network
A local transaction ends before remote calls — no REST, RPC, or broker send inside an open DB transaction.
Principle
Database transactions protect local consistency. Holding a transaction open while calling another service (or anything slow/unreliable) couples locks to the network and creates outages under load.
Therefore we practice
- Commit (or roll back) local work before remote I/O
- Do not call REST/RPC/gRPC inside an open DB transaction
- Do not publish to a broker inside an open transaction unless using a proven pattern (e.g. transactional outbox in the same commit)
- Keep transactions short; avoid user think-time inside a transaction
- If you need “write + notify,” use outbox/CDC or a workflow — not
BEGIN→ HTTP →COMMIT
Smells
- Connection pool exhaustion when a dependency slows down
- Timeouts cascading while rows stay locked
- “It works in staging” with low concurrency and fails on Black Friday
- Compensating for distributed locks that only exist because the transaction was too wide