当前位置:网站首页>分布式事务
分布式事务
2022-07-03 02:52:00 【小白要变大牛】
事务的ACID原则
A(Atomicity):原子性:事务的所有操作,要么全部成功,要么全部失败
C(Consistency):一致性:要保证数据库内部完整性约束,声明性约束
I(Isolation):隔离性:对同一资源操作的事务不能同时发生
D(Durability):持久性:对数据库做的 一切修改将永久保存,不管是否出现故障
微服务案例
微服务下单业务,在下单时会调用订单服务,创建订单并且写入数据库。
然后订单服务调用账户服务和库存服务:
•账户服务负责扣减用户余额
•库存服务负责扣减商品库存
但是如果订单微服务呵账户微服务都操作数据库没问题,但是到了库存微服务这里库存不足,那么库存微服务肯定是会操作微服务是失败的 。这时候怎么办呢?普通的事务是监听不到远程调用的账户服务和库存服务的,@Transactional是使用了AOP来实现的,增强了我们的方法,使用了后置增强如果出错了就回滚事务,但是远程的账户服务和库存服务我们是操作不了的,因为每个微服务都是独立的,只能访问微服务中开放出来的接口而不能操作它
CAP理论
C(Consistency):一致性 A(Availability):可用性 P(Partition tolerance):分区容错性
分布式系统中无法满足这三个指标
边栏推荐
- Build a private cloud disk cloudrev
- 处理数据集,使用LabelEncoder将所有id转换为从0开始
- Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
- 【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
- Pytest (6) -fixture (Firmware)
- 《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨
- HW-初始准备
- "Analysis of 43 cases of MATLAB neural network": Chapter 43 efficient programming skills of neural network -- Discussion Based on the characteristics of the new version of MATLAB r2012b
- What does "where 1=1" mean
- Gbase 8C system table PG_ attribute
猜你喜欢
Add MDF database file to SQL Server database, and the error is reported
The Linux server needs to install the agent software EPS (agent) database
vfork执行时出现Segmentation fault
HTB-Devel
Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
[flutter] example of asynchronous programming code between future and futurebuilder (futurebuilder constructor setting | handling flutter Chinese garbled | complete code example)
C language beginner level - pointer explanation - paoding jieniu chapter
Sqlserver row to column pivot
用docker 連接mysql的過程
随机推荐
迅雷chrome扩展插件造成服务器返回的数据js解析页面数据异常
Basic operation of binary tree (C language version)
What is the way out for children from poor families?
Kubernetes cluster log and efk architecture log scheme
Gbase 8C system table PG_ cast
Baidu map - surrounding search
Choose it when you decide
[C language] MD5 encryption for account password
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
Gbase 8C trigger (III)
[C语言]给账号密码进行MD5加密
sql server数据库添加 mdf数据库文件,遇到的报错
Two dimensional format array format index subscript continuity problem leads to return JSON format problem
I2C 子系統(四):I2C debug
Strategy application of Dameng database
MATLAB小技巧(24)RBF,GRNN,PNN-神经网络
Today, it's time to copy the bottom!
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
Use optimization | points that can be optimized in recyclerview