Update log
- More friendly gRPC type support, input and output support any type
- Add an example to wait for mysql when starting to avoid exiting due to slow mysql startup
Examples of new features
Example of old proto file:
message BusiRequest {
BranchInfo Info = 1;
string Dtm = 2;
bytes BusiData = 3;
}
Need to be converted when used
req := TransReq{}
dtmcli.MustUnmarshal(in.BusiData, &req)
handleGrpcBusiness(in, req.TransOutResult, dtmcli.GetFuncName())
New proto file example
message BusiReq {
int64 Amount = 1;
string TransOutResult = 2;
string TransInResult = 3;
}
When used, it is directly strongly typed and has nothing to do with the branchInfo defined by dtm, etc.
func (s *busiServer) TransOut(ctx context.Context, in *BusiReq) (*emptypb.Empty, error) {
return handleGrpcBusiness(in, in.TransOutResult)
}
In the case of the new version, the business gRPC interface is completely independent of dtm, achieving better compatibility
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 is suitable for companies with multi-language stacks. Convenient to use in various languages such as go, python, php, nodejs, ruby, and 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) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。