Update log
- Support concurrent SAGA
- Support SAGA timeout rollback
- Support custom retry interval
Examples of new features
csaga := dtmcli.NewSaga(DtmServer, dtmcli.MustGenGid(DtmServer)).
Add(Busi+"/TransOut", Busi+"/TransOutRevert", req).
Add(Busi+"/TransIn", Busi+"/TransInRevert", req).
EnableConcurrent() // 开启并发
// .AddBranchOrder(1, []int{0}) // 指定分支依赖关系
csaga.RetryInterval = 60 // 指定事务分支重试的间隔为60s
csaga.TimeoutToFail = 1800 // 指定saga事务超过1800s未完成,则进行回滚
err := csaga.Submit()
In the above code, EnableConcurrent turns on the concurrent execution of each branch of SAGA, reducing the total time-consuming of the entire SAGA transaction
The comment in the above code: AddBranchOrder(1, []int{0}), you can add dependencies between transaction branches. For example, the dependency in this line is the branch with subscript 1, and the branch with subscript 0 is dependent. Only after 0 is completed, 1 can be executed.
Cross-language distributed transaction manager
DTM is a distributed transaction manager developed by golang, which solves the consistency problem of updating data across databases, services, and language stacks.
He elegantly solves the distributed transaction problems such as idempotence, null compensation, and suspension, and provides a simple, easy-to-use, high-performance, and easy-to-scale solution.
The author was invited to participate in the China Database Conference to share distributed transaction practice in a multilingual environment
Who is using dtm
Eglass sight coffee mirror small two
[Jinshu Zhilian]()
Highlights
Extremely easy to access
- Support HTTP, provide a very simple interface, greatly reduce the difficulty of getting started with distributed transactions, and novices can quickly access
Simple to use
- Developers no longer worry about suspension, null compensation, idempotence, etc., and the framework will handle it on their behalf
Cross language
- It can be used by companies with multi-language stacks. Convenient to use in various languages such as go, python, php, nodejs, ruby, c#.
Easy to deploy, easy to expand
- Only rely on mysql, easy to deploy, easy to cluster, easy to expand horizontally
Multiple distributed transaction protocol support
- TCC, SAGA, XA, transaction news
Compared with other frameworks
At present, the open source distributed transaction framework has not yet seen a mature framework for non-Java languages. There are many Java languages, such as Ali's SEATA, Huawei's ServiceComb-Pack, JD's shardingsphere, and himly, tcc-transaction, ByteTCC, etc., among which seata is the most widely used.
The following is a comparison of the main features of dtm and seata:
characteristic | DTM | SEATA | Remark |
---|---|---|---|
Support language | Go、Java、python、php、c#... | Java | dtm can easily access a new language |
Exception handling | Sub-transaction barrier automatic processing | Manual processing | dtm solves idempotence, suspension, and null compensation |
TCC affairs | ✓ | ✓ | |
XA affairs | ✓ | ✓ | |
AT affairs | XA is recommended | ✓ | AT is similar to XA, with better performance, but with dirty rollback |
SAGA affairs | Concurrent mode | State machine complex pattern | |
Transaction message | ✓ | ✗ | dtm provides transaction messages similar to rocketmq |
Single service and multiple data sources | ✓ | ✗ | |
letter of agreement | HTTP、gRPC | Protocols such as dubbo, no HTTP | dtm is more cloud-native |
From the features of the comparison above, if your language stack includes languages other than Java, then dtm is your first choice. If your language stack is Java, you can also choose to access dtm and use sub-transaction barrier technology to simplify your business writing.
performance test report
Tutorial and documentation
If you think yedf/dtm good, or helpful to you, please give us a star!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。