当前位置:网站首页>分布式事务
分布式事务
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):分区容错性
分布式系统中无法满足这三个指标
边栏推荐
- [shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
- 左连接,内连接
- [fluent] future asynchronous programming (introduction | then method | exception capture | async, await keywords | whencomplete method | timeout method)
- I2C 子系统(三):I2C Driver
- 迅雷chrome扩展插件造成服务器返回的数据js解析页面数据异常
- vfork执行时出现Segmentation fault
- Matlab tips (24) RBF, GRNN, PNN neural network
- Counter统计数量后,如何返回有序的key
- Joking about Domain Driven Design (III) -- Dilemma
- HTB-Devel
猜你喜欢

I2C 子系统(二):I3C spec

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

Today, it's time to copy the bottom!

Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution

Build a private cloud disk cloudrev
![[hcia]no.15 communication between VLANs](/img/59/a467c5920cbccb72040f39f719d701.jpg)
[hcia]no.15 communication between VLANs
![[shutter] banner carousel component (shutter_wiper plug-in | swiper component)](/img/a6/5c97ef3f34702b83ebf0511501d757.gif)
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)

The process of connecting MySQL with docker

xiaodi-笔记

Random Shuffle attention
随机推荐
Gbase 8C trigger (I)
Source code analysis | resource loading resources
random shuffle注意
Today, it's time to copy the bottom!
Gbase 8C system table PG_ class
random shuffle注意
Your family must be very poor if you fight like this!
Gbase 8C trigger (II)
Gbase 8C trigger (III)
【翻译】Flux安全。通过模糊处理获得更多信心
leetcode540
Strategy application of Dameng database
Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
sql server数据库添加 mdf数据库文件,遇到的报错
Kubernetes cluster log and efk architecture log scheme
Gbase 8C function / stored procedure parameters (II)
Use cve-2021-43893 to delete files on the domain controller
Can netstat still play like this?
The process of connecting MySQL with docker
C语言初阶-指针详解-庖丁解牛篇