Introduction
DTM is an open-source distributed transaction framework that coordinates multi-service operations reliably. It implements industry-standard patterns including Saga, TCC, XA, and two-phase messaging, providing a language-agnostic HTTP/gRPC API so any microservice can participate in a global transaction regardless of its tech stack.
What DTM Does
- Orchestrates distributed transactions across multiple microservices and databases
- Implements Saga, TCC (Try-Confirm-Cancel), XA, and outbox patterns
- Provides an HTTP and gRPC API accessible from any programming language
- Retries failed branches automatically with configurable backoff and timeout
- Guarantees eventual consistency even when services or networks fail temporarily
Architecture Overview
DTM runs as a standalone server that stores transaction state in MySQL, Postgres, or Redis. Client SDKs register transaction branches (sub-operations) with the server. The server drives the protocol: for Saga it calls each step in sequence and triggers compensations on failure; for TCC it coordinates try, confirm, and cancel phases. A built-in cron job retries incomplete transactions.
Self-Hosting & Configuration
- Deploy the DTM server via Docker, binary, or Kubernetes Helm chart
- Configure the backend store (MySQL, Postgres, or Redis) via environment variables
- Client SDKs are available for Go, Java, Python, C#, PHP, and Node.js
- Set retry intervals, timeout durations, and concurrency limits per transaction type
- Enable the admin dashboard for monitoring in-flight and failed transactions
Key Features
- Language-agnostic HTTP/gRPC interface works with any tech stack
- Sub-transaction barriers prevent duplicate execution on retries
- Supports mixing different patterns (e.g., Saga + TCC) in one global transaction
- Admin API and dashboard for observing transaction status in real time
- Lightweight server with minimal resource requirements
Comparison with Similar Tools
- Seata — Java-centric; DTM is language-agnostic via HTTP/gRPC
- Temporal — workflow engine for general orchestration; DTM is specialized for transaction patterns
- Eventuate Tram — event-driven Saga framework for Java/Spring; DTM supports multiple patterns and languages
- Cadence — general-purpose workflow by Uber; DTM focuses on transaction consistency with simpler setup
FAQ
Q: Which transaction pattern should I choose? A: Saga is simplest for most cases. Use TCC when you need reservation semantics, and XA when your databases support two-phase commit natively.
Q: Does DTM support exactly-once execution? A: DTM provides at-least-once delivery with sub-transaction barriers that prevent duplicate side effects, achieving effectively-once semantics.
Q: What happens if the DTM server crashes? A: Transaction state is persisted in the backend store. On restart, DTM resumes incomplete transactions automatically.
Q: Can DTM work with message queues? A: Yes. The two-phase message pattern integrates with any message queue to ensure messages are sent only when the local transaction commits.