SpringCloud Alibaba - 2PC process and its advantages and disadvantages

1. 2PC process

  • In the figure below , TM represents the transaction manager; RM represents the resource manager.
    insert image description here

2. Advantages and disadvantages of 2PC

2.1. Advantages

  • Try to ensure the strong consistency of the data, and the implementation cost is low. All major databases have their own implementations. For MySQL, it has been supported since 5.5 (XA).

2.2. Disadvantages

  • Single point problem: The role of the transaction manager in the whole process is very critical. If it goes down, for example, the first phase has been completed, and the transaction manager is down when the second phase is about to be submitted, the resource manager will Blocked all the time, making the database unusable.
  • Synchronous blocking: After being ready, the resources in the resource manager are blocked until the submission is completed and the resources are released.
  • Data inconsistency: Although the two-phase commit protocol is designed for strong consistency of distributed data, there is still the possibility of data inconsistency. Only some participants received and executed the commit operation, while the rest of the participants have been blocked because they did not receive the notification, and data inconsistency occurred at this time.

Guess you like

Origin blog.csdn.net/li1325169021/article/details/131886511