分布式事務選型及對比_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=本質上來說,分布式事務就是為了保證不同數據庫的數據一致性。 強一致性、弱一致性、最終一致性.,強一致性. 任何一次讀都能讀到某個數據的