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

How to understand the distributed transaction using Seata's AT transaction mode

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

How to understand distributed transaction using Seata's AT transaction mode? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

The project uses micro-services and splits some modules. Now it encounters a scenario of batch saving and cross-service invocation, so it is relatively simple and convenient to choose Seata's AT mode.

When saving a document, because the whole order needs to save a thousand pieces of data in batches, which takes 8 seconds, first of all, look at the bottom layer of JPA's saveAll method actually called the for loop to save (the previous article "JPA batch save saveAll problem" has been mentioned), but the modified use of a custom batch save actually did not get much improvement.

Later, it was found that the service needs to cross-service with @ GlobalTransactional annotation. Although this batch save is not for other services, it will also be very time-consuming. It only takes 1 second to save after removing this annotation.

Reason:

After looking at the AT mode of the Seata official website, I personally understand that although it has been modified to save in batches, the AT mode is based on a relational database of local ACID transactions. When these data are inserted into the database, each piece of data is locked, and locking is very time-consuming. The current business needs to insert 1000 pieces of data in batches, that is, each of these 1000 pieces of data is locked.

This is the answer to the question about how to understand the distributed transaction using Seata's AT transaction mode. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

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

Internet Technology

Wechat

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

12
Report