当前位置:网站首页>分布式事务
分布式事务
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):分区容错性
分布式系统中无法满足这三个指标
边栏推荐
- 当lambda没有输入时,是何含义?
- [fluent] futurebuilder asynchronous programming (futurebuilder construction method | asyncsnapshot asynchronous calculation)
- Deep reinforcement learning for intelligent transportation systems: a survey paper reading notes
- Introduction to cron expression
- Wechat - developed by wechat official account Net core access
- sql server数据库添加 mdf数据库文件,遇到的报错
- HTB-Devel
- 一文带你了解 ZigBee
- Classes and objects - initialization and cleanup of objects - constructor call rules
- Gbase 8C function / stored procedure parameters (II)
猜你喜欢

超好用的日志库 logzero

怎么将yolov5中的PANet层改为BiFPN

random shuffle注意

Check log4j problems using stain analysis

Xiaodi notes

Random Shuffle attention

What is the way out for children from poor families?

Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)

Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)

用docker 連接mysql的過程
随机推荐
Sqlserver row to column pivot
I2C 子系统(一):I2C spec
Thunderbolt Chrome extension caused the data returned by the server JS parsing page data exception
Tensorflow to pytorch notes; tf. gather_ Nd (x, y) to pytorch
Pytest (6) -fixture (Firmware)
Gbase 8C system table PG_ class
Use optimization | points that can be optimized in recyclerview
Gbase 8C system table PG_ am
Kubernetes family container housekeeper pod online Q & A?
定了,就选它
为什么会选择框架?选择什么样的框架
Super easy to use logzero
C语言中左值和右值的区别
How to return ordered keys after counter counts the quantity
错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
Principle and application of database
Source code analysis | resource loading resources
xiaodi-笔记
Joking about Domain Driven Design (III) -- Dilemma
用docker 连接mysql的过程