当前位置:网站首页>Cap and base theory
Cap and base theory
2022-07-03 20:06:00 【lyzchengxuyuan】
- CAP theory
2000 year 7 month , University of California, Berkeley Eric Brewer Professor at ACM PODC Proposed at the meeting CAP guess .2 After year , MIT's Seth Gilbert and Nancy Lynch It is proved theoretically CAP. after ,CAP Theory has become an accepted theorem in the field of distributed computing .
CAP The theory is : A distributed system can only satisfy the consistency at most (Consistency)、 Usability (Availability) And partition fault tolerance (Partition tolerance) Two of these three .
1.1 Uniformity (Consistency)
Consistency means “all nodes see the same data at the same time”, That is, after the update operation succeeds and returns to the client , All nodes have the same data at the same time .
1.2 Usability (Availability)
Usability means “Reads and writes always succeed”, That is, the service is always available , And it's normal response time .
1.3 Partition tolerance (Partition tolerance)
Partition fault tolerance means “the system continues to operate despite arbitrary message loss or failure of part of the system”, That is, when the distributed system encounters a node or network partition failure , Still able to provide external services to meet the consistency and availability .
- CAP Balance
adopt CAP theory , We know that consistency cannot be met at the same time 、 Availability and partition fault tolerance , Which one should I give up ?
For most large Internet application scenarios , There are many hosts 、 Deployment is decentralized , And now the scale of the cluster is growing , So node failure 、 Network failure is the norm , And make sure the service availability reaches N individual 9, Guarantee P and A, Abandon C( Second, to ensure the final consistency ). Although some places can affect the customer experience , But it didn't reach the level that caused the user process .
There can't be a little concession when it comes to money ,C Must ensure . In case of network failure, it's better to stop service , This is a guarantee CA, Abandon P. It seems that in recent years, the domestic banking industry has been on the rise 10 There was an accident , But it doesn't matter , There's not much reporting , The masses know little . There is also a guarantee CP, Abandon A. For example, if there is a network fault, it is read-only and not written .
Which is better, which is less , No conclusion , It can only be decided according to the scene , What suits is the best .
- BASE theory
eBay Architect Dan Pritchett From the practice summary of large-scale distributed system , stay ACM Put forward in an article published on BASE theory ,BASE The theory is right CAP The extension of theory , The core idea is that even if strong consistency cannot be achieved (Strong Consistency,CAP Consistency is strong consistency ), But the application can achieve final consistency in a suitable way (Eventual Consitency).
BASE Basically available (Basically Available)、 Soft state ( Soft State)、 Final consistency ( Eventual Consistency).
3.1 Basic available (Basically Available)
Basic availability refers to the failure of distributed system , Partial loss of availability is allowed , That is to ensure that the core is available .
When e-commerce is booming , In response to the surge in traffic , Some users may be directed to the degraded page , The service layer may only provide degraded Services . This is the loss of some availability .
3.2 Soft state ( Soft State)
Soft state means that the system is allowed to have intermediate state , The intermediate state will not affect the overall availability of the system . In distributed storage, there are at least three copies of a data , The delay that allows the replica synchronization between different nodes is the embodiment of the soft state .mysql replication Asynchronous replication is also a manifestation of .
3.3 Final consistency ( Eventual Consistency)
Final consistency means that after a certain period of time, all data copies in the system , In the end, we can reach a consistent state . Weak consistency is the opposite of strong consistency , Final consistency is a special case of weak consistency .
4. ACID and BASE The difference and connection
ACID It is a common design concept of traditional database , The pursuit of a strong consistency model .BASE It supports large distributed systems , High availability is achieved by sacrificing strong consistency .
ACID and BASE Represents two completely opposite design philosophy
In the scenario of distributed system design , System components have different requirements for consistency , therefore ACID and BASE It will be used in combination with .
边栏推荐
- 2022-06-30 網工進階(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
- Global and Chinese market of two in one notebook computers 2022-2028: Research Report on technology, participants, trends, market size and share
- 10 smart contract developer tools that miss and lose
- QT tutorial: signal and slot mechanism
- 2022-06-25 advanced network engineering (XI) IS-IS synchronization process of three tables (neighbor table, routing table, link state database table), LSP, cSNP, psnp, LSP
- 原生表格-滚动-合并功能
- 1.5 learn to find mistakes first
- Basic command of IP address configuration ---ip V4
- 2022-06-28 advanced network engineering (XIII) IS-IS route filtering, route summary, authentication, factors affecting the establishment of Isis neighbor relations, other commands and characteristics
- An old programmer gave it to college students
猜你喜欢
2022-06-30 网工进阶(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
BOC protected phenylalanine zinc porphyrin (Zn · TAPP Phe BOC) / iron porphyrin (Fe · TAPP Phe BOC) / nickel porphyrin (Ni · TAPP Phe BOC) / manganese porphyrin (Mn · TAPP Phe BOC) Qiyue Keke
10 smart contract developer tools that miss and lose
1.5 learn to find mistakes first
Chapter 1: simplify the same code decimal sum s (D, n)
Cesiumjs 2022 ^ source code interpretation [7] - Analysis of the request and loading process of 3dfiles
Upgrade PIP and install Libraries
2.7 format output of values
Oak-d raspberry pie cloud project [with detailed code]
How can the outside world get values when using nodejs to link MySQL
随机推荐
[raid] [simple DP] mine excavation
Cesiumjs 2022 ^ source code interpretation [7] - Analysis of the request and loading process of 3dfiles
4. Data binding
2.4 conversion of different data types
Class loading process
2.3 other data types
Part 28 supplement (XXVIII) busyindicator (waiting for elements)
Sparse matrix (triple) creation, transpose, traversal, addition, subtraction, multiplication. C implementation
Chapter 1: find the factorial n of n!
Xctf attack and defense world crypto master advanced area olddriver
unittest框架基本使用
Find a line in a file and remove it
4. Data splitting of Flink real-time project
QT tutorial: signal and slot mechanism
Camera calibration (I): robot hand eye calibration
Global and Chinese markets of cast iron diaphragm valves 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of full authority digital engine control (FADEC) 2022-2028: Research Report on technology, participants, trends, market size and share
Network security Kali penetration learning how to get started with web penetration how to scan based on nmap
Detailed and not wordy. Share the win10 tutorial of computer reinstallation system
Upgrade PIP and install Libraries