What is a distributed transaction
在分布式系统环境下,不同服务之间由网络协作完成事务叫做分布式事务。
Two distributed transaction generated scene
- Different services to access different database instances
- The same service to access different database instances
- Different services accessing the same database instance
-CAP three basic theories of distributed storage system
- Consistency (Consistency): guarantee the same time, the same values of all backup data in distributed systems. Each node access to any operating system or return the same value date, or return a timeout.
- Availability (Availability): to ensure that each node access to any operating system will not timeout, even if the old data is returned.
Tolerance / fault-tolerant partition (Partition Tolerance): a node hang up, it does not affect other nodes to provide services. This is the most basic capabilities of distributed systems.
In a distributed system, consistency and availability contradictory, can not meet at the same time. We can only choose one : AP guarantee or warranty CP. MySql cluster Paul is AP, Zookeeper cluster Paul is CP.
-BASE four basic theory of distributed storage system
在实际生产环境中,AP组合使用的较多。但我们又必须保障一致性,我们可以容忍一致性有一些延迟,达到最终一致性,就产生了中间状态:数据同步中。
BASE理论是CAP中AP的一个扩展:通过牺牲强一致性(随时随地一致)来获得可用性,当出现故障部分不可用但是核心功能可用,允许数据一段时间内不一致,但最终一致。满足BASE理论的事务,我们可以称之为**柔性事务**。
BASE:
基本可用 Basically Available:当出现故障部分不可用但是核心功能可用
软状态 Soft State:允许中间状态(支付中、数据同步中)
最终一致 Eventually Consistent:所有节点数据最终达到一致