Distributed Transactions Explained: 2 Phase Commit vs Saga Pattern
3-Second Blueprint (English)
- Splitting orders across payment, inventory, and ledger microservices breaks single-database ACID atomicity and isolation.
- Two-Phase Commit holds row locks across prepare and commit phases, moving at the slowest node's speed and stalling on crashes.
- Production systems favor orchestrated Sagas with idempotent retries, visible compensations (like refunds), and a transactional outbox.
Two-Phase Commit (2PC)Saga PatternOrchestration vs ChoreographyCompensating TransactionsTransactional OutboxIdempotent Retries
3-Sekunden-Fazit (Deutsch)
- Die Aufteilung auf Zahlungs-, Bestands- und Buchhaltungs-Services bricht die lokale ACID-Atomarität und -Isolation einer Datenbank.
- Two-Phase Commit hält Zeilensperren über Prepare- und Commit-Phasen, bremst auf den langsamsten Dienst ab und blockiert bei Abstürzen.
- Produktivsysteme nutzen orchestrierte Sagas mit idempotenten Retries, Kompensationsaktionen (wie Rückbuchungen) und Transactional Outbox.
Two-Phase Commit (2PC)Saga-PatternOrchestrierung vs. ChoreografieKompensationstransaktionenTransactional OutboxIdempotente Retries
Note / Hinweis: Blueprints are AI-generated educational summaries (0% Politics · 0% Religion · 0% Brainrot) and do not constitute medical, legal, or financial advice. / KI-generierte Zusammenfassung zu Bildungszwecken – ersetzt keine medizinische, rechtliche oder finanzielle Fachberatung.