当前位置:网站首页>Distributed base theory
Distributed base theory
2022-07-06 00:53:00 【It blade out of sheath】
Original website :
brief introduction
This article introduces BASE theory .
For business systems , We often choose to sacrifice consistency for system availability and partition fault tolerance . But the point here is , So-called “ Sacrifice consistency ” It's not all about giving up data consistency , It's sacrifice Strong consistency Exchange for Weak consistency .
Base theory : Basic available (Basically Available), Soft state (Soft State), Final consistency (Eventually Consistent)
Basic Available
Suppose the system , There was an unforeseen breakdown , But it still works , Compared with a normal system, there are the following losses :
- Loss of response time : Example : Normal search engines 0.5 Seconds to return the result to the user , And basically available search engines can be found in 2 Second action returns the result .
- Loss of function : Example : On an e-commerce website , Under normal circumstances , Users can successfully complete every order . But when it comes to the promotion period , In order to protect the stability of the shopping system , Some consumers may be directed to a degraded page .
Soft State
Hard state : Compared with atomicity , The data copies of multiple nodes are required to be consistent .
Soft state : Allow data in the system to have intermediate states , It is considered that this state does not affect the overall availability of the system , That is to say, the system is allowed to have data delay in data copies of multiple different nodes .
Eventually Consistent
It says soft state , Then it can't be soft all the time , There must be a time limit . After the deadline , Data consistency should be guaranteed for all copies , So as to achieve the final consistency of data . This time period depends on the network delay 、 System load 、 Data replication scheme design and other factors .
In practical engineering practice , The final consistency is divided into 5 Kind of :
term | explain |
Causal consistency (Causal consistency) | If node A After updating some data, the node is notified B, Then the node B Later, the access and modification of the data are based on A Updated value . meanwhile , And nodes A Nodes without causality C There are no such restrictions on data access . |
Read what you have written (Read your writes) | node A After updating a data , It always has access to the latest values it has updated , Instead of seeing the old value . Actually, it's also a kind of causal consistency . |
Conversation consistency (Session consistency) | Session consistency frames the process of accessing system data in a session : The system can guarantee the same effective session “ Read what you have written ” The consistency of , in other words , After performing the update operation , The client can always read the latest value of the data item in the same session . |
Monotonous reading consistency (Monotonic read consistency) | If a node reads a value of a data item from the system , Then the system should not return the older value for any subsequent data access of the node . |
Monotonous writing consistency (Monotonic write consistency) | A system should be able to ensure that writes from the same node are executed sequentially . |
In practice , this 5 These systems are often used in combination , To build a distributed system with ultimate consistency .
actually , It's not just distributed systems that use ultimate consistency , Relational database in a certain function , Also using final consistency . Such as backup , The database replication process takes time , In this replication process , The value read by the business is old . Of course , In the end, data consistency was achieved . This is a classic case of ultimate consistency .
ACID It can guarantee the strong consistency of transactions , That is, the data is consistent in real time . This is no problem in local transactions , In distributed transactions , Strong consistency will greatly affect the performance of distributed systems , So the distributed system follows BASE Theory is enough .
Different business scenarios of distributed systems have different requirements for consistency . Such as in the trading scenario , It requires strong consistency , At this point you need to follow ACID theory , And send SMS verification code after registration , There's no need for real-time consistency , So follow BASE Theory is enough .
According to specific business scenarios , stay ACID and BASE Find a balance between .
Other websites
《 from Paxos To Zookeeper Principle and practice of distributed consistency 》
边栏推荐
- Differences between standard library functions and operators
- Why can't mathematics give machine consciousness
- Folding and sinking sand -- weekly record of ETF
- devkit入门
- Common API classes and exception systems
- Overview of Zhuhai purification laboratory construction details
- Zhuhai laboratory ventilation system construction and installation instructions
- How spark gets columns in dataframe --column, $, column, apply
- 在产业互联网时代,将会凭借大的产业范畴,实现足够多的发展
- Study diary: February 13, 2022
猜你喜欢
Four commonly used techniques for anti aliasing
Study diary: February 13, 2022
Finding the nearest common ancestor of binary tree by recursion
Installation and use of esxi
MySQL storage engine
Basic introduction and source code analysis of webrtc threads
vSphere实现虚拟机迁移
关于#数据库#的问题:(5)查询库存表中每本书的条码、位置和借阅的读者编号
MIT博士论文 | 使用神经符号学习的鲁棒可靠智能系统
Differences between standard library functions and operators
随机推荐
Interview must brush algorithm top101 backtracking article top34
Promise
Uniapp development, packaged as H5 and deployed to the server
Spark DF增加一列
ubantu 查看cudnn和cuda的版本
What is the most suitable book for programmers to engage in open source?
Power query data format conversion, Split Merge extraction, delete duplicates, delete errors, transpose and reverse, perspective and reverse perspective
Recoverable fuse characteristic test
How spark gets columns in dataframe --column, $, column, apply
Leetcode Fibonacci sequence
[EI conference sharing] the Third International Conference on intelligent manufacturing and automation frontier in 2022 (cfima 2022)
Natural language processing (NLP) - third party Library (Toolkit):allenlp [library for building various NLP models; based on pytorch]
免费的聊天机器人API
The third season of ape table school is about to launch, opening a new vision for developers under the wave of going to sea
[simple implementation of file IO]
NLP generation model 2017: Why are those in transformer
Cf:h. maximum and [bit operation practice + K operations + maximum and]
devkit入门
Study diary: February 13, 2022
Cloud guide DNS, knowledge popularization and classroom notes