Introduction
Seata (Simple Extensible Autonomous Transaction Architecture) is an open-source distributed transaction framework incubated at Alibaba and now an Apache project. It solves the data consistency problem in microservice architectures by providing multiple transaction modes — AT, TCC, Saga, and XA — so developers can maintain ACID properties across service boundaries.
What Seata Does
- Coordinates distributed transactions across multiple microservices and databases
- Provides AT (Automatic Transaction) mode for low-intrusion distributed transactions on SQL databases
- Supports TCC (Try-Confirm-Cancel) mode for high-performance scenarios requiring explicit compensation
- Offers Saga mode for long-running business processes with step-by-step compensation
- Implements XA mode for strict two-phase commit using database-native XA support
Architecture Overview
Seata consists of three roles: Transaction Coordinator (TC) is the server that maintains global transaction state and drives commit or rollback. Transaction Manager (TM) defines the scope of a global transaction by beginning and committing/rolling back. Resource Manager (RM) manages branch transactions at each microservice, registering branches and reporting status to the TC. In AT mode, Seata intercepts SQL, generates undo logs automatically, and handles rollback without manual compensation code.
Self-Hosting & Configuration
- Deploy Seata Server (TC) standalone or in cluster mode behind a registry like Nacos
- Configure store mode to use database, Redis, or Raft for transaction log persistence
- Add the Seata Spring Boot Starter to each participating microservice
- Configure each service with the transaction group name and registry address
- Set up the undo_log table in each business database for AT mode rollback support
Key Features
- Four transaction modes (AT, TCC, Saga, XA) covering different consistency and performance trade-offs
- AT mode requires zero business code changes — Seata generates undo logs automatically
- High availability with Raft-based server clustering and multiple storage backends
- Integration with Spring Cloud, Dubbo, gRPC, and Motan RPC frameworks
- Global lock mechanism to prevent dirty writes across concurrent transactions
Comparison with Similar Tools
- DTM — Lightweight Go-based distributed transaction manager; Seata is more mature with broader Java ecosystem integration
- Atomikos — JTA transaction manager for local deployments; Seata handles cross-service distributed transactions at scale
- Apache ServiceComb Pack — Saga-based compensation; Seata offers more transaction modes including AT and XA
- Temporal — Durable workflow engine; Seata focuses specifically on database transaction consistency rather than workflow orchestration
- Manual compensation — Custom rollback code; Seata automates undo in AT mode, reducing boilerplate and bugs
FAQ
Q: Which transaction mode should I choose? A: AT mode is the default for most SQL database workloads with minimal code changes. Use TCC for high-performance non-SQL scenarios, Saga for long-running processes, and XA when strict 2PC is required.
Q: Does Seata support non-Java languages? A: Seata has a Go SDK (seata-go) and Golang server. The primary ecosystem is Java-centric, but cross-language support is expanding.
Q: What databases does AT mode support? A: AT mode supports MySQL, PostgreSQL, Oracle, MariaDB, and other JDBC-compatible databases with SQL parsing support.
Q: How does Seata affect performance? A: AT mode adds one extra round-trip per branch transaction for undo log registration. In benchmarks the overhead is typically single-digit milliseconds per branch.