当前位置:网站首页>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 》
边栏推荐
- esxi的安装和使用
- Convert binary search tree into cumulative tree (reverse middle order traversal)
- Basic introduction and source code analysis of webrtc threads
- Browser reflow and redraw
- 面试必刷算法TOP101之回溯篇 TOP34
- Spark获取DataFrame中列的方式--col,$,column,apply
- Meta AI西雅图研究负责人Luke Zettlemoyer | 万亿参数后,大模型会持续增长吗?
- Study diary: February 13, 2022
- 95后CV工程师晒出工资单,狠补了这个,真香...
- KDD 2022 | EEG AI helps diagnose epilepsy
猜你喜欢
Introduction of motor
Differences between standard library functions and operators
2022-02-13 work record -- PHP parsing rich text
【EI会议分享】2022年第三届智能制造与自动化前沿国际会议(CFIMA 2022)
Mobilenet series (5): use pytorch to build mobilenetv3 and learn and train based on migration
Spark SQL null value, Nan judgment and processing
View class diagram in idea
Arduino六足机器人
Data analysis thinking analysis methods and business knowledge - analysis methods (III)
Arduino hexapod robot
随机推荐
Synchronized and reentrantlock
[simple implementation of file IO]
Zhuhai's waste gas treatment scheme was exposed
Ffmpeg captures RTSP images for image analysis
A preliminary study of geojson
cf:H. Maximal AND【位运算练习 + k次操作 + 最大And】
The detailed page returns to the list and retains the original position of the scroll bar
The relationship between FPGA internal hardware structure and code
C language programming (Chapter 6 functions)
Questions about database: (5) query the barcode, location and reader number of each book in the inventory table
How to use the flutter framework to develop and run small programs
激动人心,2022开放原子全球开源峰会报名火热开启
The growth path of test / development programmers, the problem of thinking about the overall situation
golang mqtt/stomp/nats/amqp
从 1.5 开始搭建一个微服务框架——调用链追踪 traceId
Getting started with devkit
关于#数据库#的问题:(5)查询库存表中每本书的条码、位置和借阅的读者编号
程序员成长第九篇:真实项目中的注意事项
MCU realizes OTA online upgrade process through UART
几百行代码实现一个 JSON 解析器