Distributed Transactions

Distributed transactions koordinieren Updates über mehrere Ressourcen hinweg, um Atomicity, Consistency, Isolation und Durability in einem verteilten System aufrechtzuerhalten.

Distributed transactions koordinieren Updates über mehrere, oft heterogene, Ressourcen hinweg, um eine einzelne logische Operation abzuschließen. Sie zielen darauf ab, ACID-Properties über Resource Manager hinweg zu erhalten, die keinen gemeinsamen Datastore teilen. Gängige Koordinationsansätze umfassen Two-Phase Commit (2PC), Three-Phase Commit (3PC) oder Compensating Transactions (Sagas) für langlaufende Workflows. Wichtige Anliegen sind Coordination Blocking, Single Points of Failure, Latenz und die Handhabung von Teilfehlern mit Rollback oder Kompensation. Praktisches Design verwendet oft einen Transaction Manager und Resource Manager, die standardisierte Schnittstellen wie XA/JTA oder DTC unterstützen, und kann Outbox Patterns, Idempotent Operations und Logging für Auditierbarkeit nutzen. In zeitgenössischen Microservice-Architekturen wird starke globale ACID oft zugunsten von Eventual Consistency mit kompensierenden Aktionen aufgegeben, um Verfügbarkeit und Latenz zu verbessern.

        graph LR
  Center["Distributed Transactions"]:::main
  Rel_decentralized_derivatives_pricing_models["decentralized-derivatives-pricing-models"]:::related -.-> Center
  click Rel_decentralized_derivatives_pricing_models "/terms/decentralized-derivatives-pricing-models"
  Rel_transaction_sharding["transaction-sharding"]:::related -.-> Center
  click Rel_transaction_sharding "/terms/transaction-sharding"
  Rel_decentralized_exchange_dex_order_book["decentralized-exchange-dex-order-book"]:::related -.-> Center
  click Rel_decentralized_exchange_dex_order_book "/terms/decentralized-exchange-dex-order-book"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧒 Erkläre es wie einem 5-Jährigen

Generated ELI5 content

🤓 Expert Deep Dive

Generated expert content

❓ Häufig gestellte Fragen

What is a distributed transaction?

A transaction that spans multiple networked resources and coordinates to appear atomic across all participants.

What does ACID mean in this context?

Atomicity, Consistency, Isolation, and Durability, applied across multiple resources through coordination protocols.

What is two-phase commit (2PC)?

A protocol with a prepare phase and a commit phase to ensure all participants commit or roll back together.

What about sagas and compensating actions?

Sagas sequence local transactions with compensating actions to achieve long-running distributed transactions without locking all resources.

What are common failure modes?

Coordinator failure, participant failure, network partitions, and lock contention can lead to blocking or partial commits.

When should you use 2PC vs sagas?

Use 2PC for short, strongly consistent, bounded transactions; use sagas for long-running processes requiring high availability and eventual consistency.

What are alternatives to strict ACID?

Eventual consistency models, compensating actions, and idempotent design patterns.

📚 Quellen