Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the distributed transaction framework DogTcc like

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail what the distributed transaction framework DogTcc is like. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

What is Dog Tcc?

DogTcc is a high performance distributed transaction TCC framework based on annotations. Thanks to his framework design, 2ms/ transactions can be achieved, chain calls are supported, and loss increases linearly.

Frame characteristic

High speed, transaction initiator loss 2.15ms per transaction, transaction tuned loss 2.13ms per transaction

Loss increases with the broadening of the transaction chain [A calls BMagazine C Magi D Magi E..], or deeper [A calls B Magi B calls C Magne C calls D..], which increases linearly.

There is no intrusion into the original service, the annotation is based on the method rather than the RPC interface, and can be added to the minimum unit method that needs to be rolled back

Easy to use, users can integrate the framework by tagging and implementing the specified rollback and confirmation interfaces.

Nodes do not have a local state, and multiple nodes can be deployed to realize the cluster without redundant configuration.

Independent of the protocol, the consumer can be integrated into the framework as long as the protocol injection of the transaction is implemented. Refer to the Spring module.

Independent of the message server, the framework provides a message service interface, and consumers can use other message middleware. Please refer to the zookeeper module

Transaction chain is supported, and the length of transaction chain does not affect transaction performance.

Failure recovery, any loss of the service node will not affect the final consistency, and the transaction of the lost node will be hosted by the same kind of node, or recovered when the lost node starts.

Error notification. For extreme cases, if Confirm or Cancel fails, the system will notify you through a third-party interface, and the user needs to implement the methods defined by this interface.

Performance report

Test machine configuration

Cpu family: 6 model: 63 model name: Intel (R) Xeon (R) CPU E5-2620 v3 @ 2.40GHz

Linux version 3.10.0-327.el7.x86_64

4G

Memory

Operating system

Cpu

Startup configuration

Zookeeper default configuration startup

Registry and Server1 Server2 Server3

Startup parameter:-Xms256m-Xmx512m

Test cases [see Server1ApplicationController of Server1 Project]

Chain call: Server1 calls Server2, Server3; Server2 calls Server3

Single call: Server1 calls Server3

In order to reduce the impact of business on framework performance testing, the business code for Server2 and Server3 is empty.

There is a Call unit in Server2

For the definition of Call (method with rollback requirements), please see: https://github.com/sunpengChina/dog/wiki/DogTcc-architecture

There are two Call units in Server3

Performance report

[1] 5000 non-threaded non-TCC transaction calls: 11325ms

[2] non-threaded 5000 single calls to TCC transactions: 34133ms

[3] 10 threads, each 500 cycles, a total of 5000 chained, TCC transaction calls: 49826ms

[4] 10 threads, 500 loops each, 5000 chained, non-TCC transaction calls: 6458ms

[5] 10 threads, each 5000 loops, TCC transaction single call: 35566ms

[6] 10 threads, each 5000 cycles, non-TCC transaction single call: 2884ms

Conclusion

Let tcc be called in a single time, and the initiator loss is x (ms) and the call loss is y (ms).

According to [3] and [4] of the performance report, x + 3y = (49826-6458) / 5000 = 8.67 ms

According to [5] and [6] of the performance report, x + 2y = (35566-2884) / 5000 = 6.52 ms

The single loss of tcc initiator is 2.25ms and that of Call is 2.13ms.

Quick start

Prepare zookeeper

Wget https://raw.githubusercontent.com/wiki/sunpengChina/dog/zookeeper-3.4.13.zip

Extract the file unzip zookeeper-3.4.13.zip

Enter the zk directory cd zookeeper-3.4.13/bin

Start the zk server. / zkServer.sh start

Open the zk client. / zkCli.sh

Execute create / dog "dog" in the zk client

Download the source code

Https://github.com/sunpengChina/dog.git

Go to the source root directory and compile the source code mvn clean install

Start the service

Start springCloud configuration Center: cd jar-jar eureka/target/eureka-1.0-SNAPSHOT.jar

Start the service Server1:jar-jar Server1/target/Server1-1.0-SNAPSHOT.jar

Start the service Server2:jar-jar Server2/target/Server2-1.0-SNAPSHOT.jar

Start the service Server3:jar-jar Server3/target/Server3-1.0-SNAPSHOT.jar

Test in the browser

Http://127.0.0.1:8081/chainTcc a chained transaction call to verify that your system is deployed properly

Time of 5000 no transaction calls in http://127.0.0.1:8081/noTcc5000

Time of 5000 simple transaction units in http://127.0.0.1:8081/singleTcc5000

Each of the 10 threads of http://127.0.0.1:8081/chainTcc5000thread calls the TCC chained transaction 500 times, and the time required for the call

The time required for each of the 10 threads of http://127.0.0.1:8081/chainNoTcc5000thread to call chain non-TCC transactions

The time required for each of the 10 threads of http://127.0.0.1:8081/singleTcc5000thread to call non-chained TCC transactions

Http://127.0.0.1:8081/singleNoTcc5000thread 10 threads each call non-chained non-TCC transaction 500 times, the time required to call

About how the distributed transaction framework DogTcc is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report