当前位置:网站首页>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 》
边栏推荐
- [Online gadgets] a collection of online gadgets that will be used in the development process
- 猿桌派第三季开播在即,打开出海浪潮下的开发者新视野
- The third season of ape table school is about to launch, opening a new vision for developers under the wave of going to sea
- 激动人心,2022开放原子全球开源峰会报名火热开启
- The growth path of test / development programmers, the problem of thinking about the overall situation
- What is the most suitable book for programmers to engage in open source?
- After Luke zettlemoyer, head of meta AI Seattle research | trillion parameters, will the large model continue to grow?
- Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]
- Programmer growth Chapter 9: precautions in real projects
- MobileNet系列(5):使用pytorch搭建MobileNetV3并基于迁移学习训练
猜你喜欢
[groovy] compile time metaprogramming (compile time method injection | method injection using buildfromspec, buildfromstring, buildfromcode)
Idea远程提交spark任务到yarn集群
Finding the nearest common ancestor of binary tree by recursion
Folding and sinking sand -- weekly record of ETF
Arduino hexapod robot
95后CV工程师晒出工资单,狠补了这个,真香...
Ffmpeg captures RTSP images for image analysis
MIT博士论文 | 使用神经符号学习的鲁棒可靠智能系统
esxi的安装和使用
[groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)
随机推荐
Spark AQE
MySQL storage engine
Analysis of the combination of small program technology advantages and industrial Internet
[groovy] compile time metaprogramming (compile time method injection | method injection using buildfromspec, buildfromstring, buildfromcode)
猿桌派第三季开播在即,打开出海浪潮下的开发者新视野
MYSQL---查询成绩为前5名的学生
KDD 2022 | EEG AI helps diagnose epilepsy
Programmer growth Chapter 9: precautions in real projects
Folding and sinking sand -- weekly record of ETF
C language programming (Chapter 6 functions)
Spark SQL UDF function
For a deadline, the IT fellow graduated from Tsinghua suddenly died on the toilet
Recoverable fuse characteristic test
MIT博士论文 | 使用神经符号学习的鲁棒可靠智能系统
logstash清除sincedb_path上传记录,重传日志数据
Idea remotely submits spark tasks to the yarn cluster
Cf:h. maximum and [bit operation practice + K operations + maximum and]
DD's command
2022-02-13 work record -- PHP parsing rich text
[groovy] compile time metaprogramming (compile time method interception | find the method to be intercepted in the myasttransformation visit method)