Distributed and distributed transaction solutions

 

Background of distributed generation :

1. When there are multiple data sources for traditional projects;

2. In the RPC remote call, after initiator A calls interface B successfully, the initiator suddenly reports an error (at this time, party B may have submitted, and A cannot report back to B after reporting an error);

Solution : Using final consistency and 2PC or 3PC (two-phase commit, three-phase commit), a short data delay is allowed, but the final data should be consistent.

Solution :

1. JTA + Atomic, suitable for traditional projects

2. Solve distributed transactions based on MQ compensation, RabbitMQ

3. RocketMQ comes with transaction messages;
4. Solve distributed transactions based on LCN, principle: proxy our own data source to rewrite connection Commit and Rollback methods to achieve false shutdown, pass the global ID of the transaction;
5. Solve distributed based on Seata Transaction, the principle is the same as LCN, the
difference between the two is: the way of rollback, LCN rollback is a false shutdown is easy to cause a deadlock, but
seata uses undo log log to generate SQL statements to achieve rollback.

The above five schemes are suitable for service realization of internal projects of enterprises .


If it is an external and external interface to solve the distributed transaction problem, you can use an asynchronous callback method similar to Alipay + active query

 

Guess you like

Origin www.cnblogs.com/long2050/p/12694690.html