[SpringCloud] SpringCloud Alibaba Seata handles distributed transactions

1. Distributed transaction issues

 1.1 Before Distributed

Stand-alone single library does not have this problem

  • 从1:1 -> 1:N -> N: N

1.2 After distribution

The monolithic application is split into microservice applications, and the original three modules are split into three independent applications, using three independent data sources, and business operations need to call three services to complete. At this time, the internal data consistency of each service is guaranteed by local transactions, but the global data consistency problem cannot be guaranteed.

The business logic of the user's purchase of goods. The entire business logic is supported by 3 microservices:

  • Warehousing service : deduct the storage quantity for a given product.
  • Order service : create orders based on purchase requirements.
  • Account service : deduct the balance from the user account.

Create order -> deduct inventory -> deduct amount

In short, a business operation needs to cross multiple data sources or need to make RPC remote calls across multiple systems, which will cause distributed transaction problems.

2. Seat

Seata is an open source distributed transaction solution dedicated to providing high-performance and easy-to-use distributed transaction services under the microservice architecture. Seata will provide users with AT, TCC, SAGA and XA transaction modes to create a one-stop distributed solution for users.

  • Official document address:

Guess you like

Origin blog.csdn.net/qq_41893274/article/details/113788608