分布式事务方案选型对比

分布式事务选型及对比_jianchileiliang的博客-CSDN博客
https://blog.csdn.net/jianchileiliang/article/details/114286094

  • LCN优缺点

    • 优点
      • 保证数据的强一致性
    • 缺点
      • 可能会造成死锁的现象,比如,订单服务调用派单服务成功以后,订单服务还没执行完毕就宕机,此时,TxManage并没有收到通知,派单服务的事务也不能顺利进行,导致死锁。
      • lcn的性能不是特别强大。
  • Seata优缺点

    • 优点
      • seata的性能比lcn要好
      • seata不会造成死锁的情况
    • 缺点
      • seata没有管理化界面
      • seata会造成数据的脏读,不能保证数据的强一致性,只能保证最终一致性。

seata和lcn比较,有什么不一致?

  • *此题可能会被面试官问到,需要多多注意哦
    • seata和lcn大致的实现思路是一致的,但是回滚的机制不一样。
    • lcn是采取代理数据源的模式,再根据发起方执行本地事务的结果进行回滚或者提交。
    • seata采取的是根据undo_log日志表,进行逆向生成sql语句,来解决回滚。
    • lcn能够保证强一致性,但可能发生死锁的现象。
    • seata能保证最终一致性,但可能造成脏读。

————————————————
版权声明:本文为CSDN博主「envoke.」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_42556214/article/details/105796048

对比 5 种分布式事务方案,还是宠幸了阿里的 Seata(原理 + 实战) - 云+社区 - 腾讯云
https://cloud.tencent.com/developer/article/1761074

Seata Server
file.conf
file.conf 文件用于配置持久化事务日志的模式,目前提供 file、db、redis 三种方式。
【注意】
在选择 db 方式后,
需要在对应数据库
创建
globalTable(持久化全局事务)、
branchTable(持久化各提交分支的事务)、
lockTable(持久化各分支锁定资源事务)三张表。

-- the table to store GlobalSession data
-- 持久化全局事务
CREATE TABLE IF NOT EXISTS global_table
(
xid VARCHAR(128) NOT NULL,
transaction_id BIGINT,
status TINYINT NOT NULL,
application_id VARCHAR(32),
transaction_service_group VARCHAR(32),
transaction_name VARCHAR(128),
timeout INT,
begin_time BIGINT,
application_data VARCHAR(2000),
gmt_create DATETIME,
gmt_modified DATETIME,
PRIMARY KEY (xid),
KEY idx_gmt_modified_status (gmt_modified, status),
KEY idx_transaction_id (transaction_id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;

-- the table to store BranchSession data
-- 持久化各提交分支的事务
CREATE TABLE IF NOT EXISTS branch_table
(
branch_id BIGINT NOT NULL,
xid VARCHAR(128) NOT NULL,
transaction_id BIGINT,
resource_group_id VARCHAR(32),
resource_id VARCHAR(256),
branch_type VARCHAR(8),
status TINYINT,
client_id VARCHAR(64),
application_data VARCHAR(2000),
gmt_create DATETIME(6),
gmt_modified DATETIME(6),
PRIMARY KEY (branch_id),
KEY idx_xid (xid)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;

-- the table to store lock data
-- 持久化每个分支锁表事务
CREATE TABLE IF NOT EXISTS lock_table
(
row_key VARCHAR(128) NOT NULL,
xid VARCHAR(96),
transaction_id BIGINT,
branch_id BIGINT NOT NULL,
resource_id VARCHAR(256),
table_name VARCHAR(32),
pk VARCHAR(36),
gmt_create DATETIME,
gmt_modified DATETIME,
PRIMARY KEY (row_key),
KEY idx_branch_id (branch_id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;

registry.conf
registry.conf 文件设置 注册中心 和 配置中心:
目前
注册中心支持 nacos 、eureka、redis、zk、consul、etcd3、sofa 七种,这里我使用的 eureka作为注册中心 ;
配置中心支持 nacos 、apollo、zk、consul、etcd3 五种方式。

Seata
https://seata.io/zh-cn/index.html

History
Ant Financial
XTS: Extended Transaction Service. Ant Financial middleware team developed the distributed transaction middleware since 2007, which is widely used in Ant Financial and solves the problems of data consistency across databases and services.

DTX: Distributed Transaction Extended. Since 2013, XTS has been published on the Ant Financial Cloud, with the name of DTX .

Alibaba
TXC: Taobao Transaction Constructor. Alibaba middleware team started this project since 2014 to meet the distributed transaction problems caused by application architecture change from monolithic to microservices.
GTS: Global Transaction Service. TXC as an Aliyun middleware product with new name GTS was published since 2016.
Fescar: we started the open source project Fescar based on TXC/GTS since 2019 to work closely with the community in the future.

分布式事务
https://moon_egg.gitee.io/2021/06/02/%E5%88%86%E5%B8%83%E5%BC%8F%E4%BA%8B%E5%8A%A1/%E5%88%86%E5%B8%83%E5%BC%8F%E4%BA%8B%E5%8A%A1/

seata: Seata 是一款开源的分布式事务解决方案,提供高性能和简单易用的分布式事务服务
https://gitee.com/seata-io/seata

分布式事务选型及对比_Quan-CSDN博客_分布式事务框架哪个好
https://blog.csdn.net/qq_42556214/article/details/105796048

分布式事务之 Atomikos 原理和使用(一)_nandao158的博客-CSDN博客_atomikos原理
https://blog.csdn.net/nandao158/article/details/108549395

开源分布式事务中间件Seata使用指南 - 知乎
https://zhuanlan.zhihu.com/p/75269870

分布式事务解决方案与适用场景分析 - 知乎
https://zhuanlan.zhihu.com/p/34232350

分布式初探——分布式事务与两阶段提交协议 - 知乎
https://zhuanlan.zhihu.com/p/104552732

分布式事务框架seata落地实践 - 知乎
https://zhuanlan.zhihu.com/p/382559160

开源分布式事务中间件Seata使用指南 - 知乎
https://zhuanlan.zhihu.com/p/75269870

分布式事务解决方案框架(LCN) - 简书
https://www.jianshu.com/p/73beee3c70e9

github.com
https://github.com/codingapi/tx-lcn/wiki/LCN原理

微服务分布式事务解决方案 TX-LCN 框架 - JeeSite 4.x
https://jeesite.com/docs/springcloud-lcn/#配置-tc-客户端

TXC分布式事务简介_浮生一梦-CSDN博客_txc分布式事务
https://blog.csdn.net/m0_38110132/article/details/77043580

Atomikos简介_猎户星座。-CSDN博客_atomikos
https://blog.csdn.net/qq_24313635/article/details/104093172

分布式事务,这一篇就够了 | 小米信息部技术团队
https://xiaomi-info.github.io/2020/01/02/distributed-transaction/#:~:text=本质上来说,分布式事务就是为了保证不同数据库的数据一致性。 强一致性、弱一致性、最终一致性.,强一致性. 任何一次读都能读到某个数据的

原文地址:https://www.cnblogs.com/rgqancy/p/15123097.html