_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Distributed Transactions — přehled

23. 07. 2025 1 min read intermediate

Architecture Expert

Distributed Transactions — přehled

Distributed TransactionsOutbox2PC 3 min read

Jak řešit transakce napříč mikroservisami. 2PC, Saga, Outbox pattern a TCC.

2PC

Two-Phase Commit: blokující, pomalý, coordinator = SPOF. V mikroservisách se nepoužívá.

Outbox Pattern

BEGIN;
INSERT INTO orders (id, total) VALUES ('ord-1', 1000);
INSERT INTO outbox (aggregate_type, payload) VALUES (
    'Order', '{"type": "OrderCreated", "orderId": "ord-1"}'
);
COMMIT;
-- Debezium CDC čte outbox a publishuje eventy

Saga vs TCC

  • Saga — sekvence lokálních transakcí + kompenzace
  • TCC (Try-Confirm-Cancel) — rezervace → potvrzení/zrušení

Summary

Saga je nejčastější volba, Outbox řeší reliable messaging. 2PC se v mikroservisách vyhýbejte.

Need Help with Implementation?

Our team has experience designing and implementing modern architectures. We’re happy to help.

Free Consultation

Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.