当前位置:网站首页>Why is cap the foundation of distributed theory?

Why is cap the foundation of distributed theory?

2020-12-07 06:27:28 58 Shen Jian

Distributed systems are very focused on three metrics :

(1) Data consistency ;

(2) System availability ;

(3) Node connectivity and scalability ;

What is the relationship between these three indicators , Today, let's talk about the basics of distributed theory CAP.

What is data consistency ?

data “ Strong consistency ”, You want the system to read only the latest data written , for example : Through a single point of serialization , You can achieve this effect .

About session Uniformity ,DB Master slave consistency ,DB Double principal consistency ,DB And Cache Uniformity , Data redundancy consistency , Message timing consistency , Distributed transaction consistency , Consistency of inventory deduction , There are similar consistency problems .

What usability ?

If every time the system runs 100 Time units , There will be 1 Time units can't provide services , The usability of the system is 99%.

Usability and reliability They are two indicators that are easy to confuse , Take a ATM for example :

(1) Correct input , Be able to get the right money , The system is reliable ;

(2) ATM 7*24 Hour service , Indicates that the system is available ;

The way to ensure high availability of the system is :

(1) redundancy ;

(2) Auto fail over ;

What is connectivity and extensibility ?

Distributed systems , There are often multiple nodes , Between each node , They're not completely independent , Need to communicate with each other , When a node fails to connect , Whether the data can still be consistent , How to deal with fault tolerance , It's something to consider .

meanwhile , Connectivity and scalability are closely related , Want to add machine scalability , There has to be good connectivity . When a node leaves the system , There's something wrong with the system , It often means that the system is not scalable .

What is? CAP Theorem ?

CAP Theorem , Three features of the above distributed system , It is concluded that :

(1) Uniformity (Consistency);

(2) Usability (Availability);

(3) Zone tolerance (Partition Tolerance);

also , The theorem states that , When the system is implemented , At most, these three take into account two points .

Uniformity , Usability , Multi node scalability can only take two of the three , Now that the lock has been added , What are the common best engineering architecture practices ?

Internet , The most common practice is this :

(1) Node connectivity , Multi node scalability , The handling of connectivity exceptions must ensure that , Satisfy P;

(2) Uniformity C Availability A Generally, choose one from two ;

(3) Selection consistency C, give an example : Traditional single database horizontal segmentation , This is a typical example of this type of selection ;

(4) Select availability A, give an example : Dual master database synchronization high availability , This is a typical example of this type of selection ;

Strong consensus is hard to do ?

Single point serialization , Although it can guarantee “ Strong consistency ”, But for the concurrent performance of the system , And high availability has a big impact , How to play the Internet , Is more of a “ Final consistency ”, You don't have to read the latest data in the short term , But after an acceptable time window , Be able to read the latest data .

for example : Database master slave synchronization , From the data on the library , It's a final agreement .

summary

(1)CAP It can be understood as consistency , Usability , Connectivity and scalability ;

(2)CAP There are only two of them ;

(3) The most common practice is AP+ Final consistency ;

except CAP, If you want to learn distributed theory systematically , Here I recommend sun Xuan's 《 Trillions of enterprise distributed transaction architecture design strategy 》,3 Days of lessons , free .

subject : Trillions of enterprise distributed transaction architecture design strategy

lecturer : Sun Xuan

Time :12.8-12.10 Three days ,20:00 Start

cost : free ( The original price 499, Present price 9.8, I'm completely out of school )

Quota :200 name , First come first served basis

How to participate in ?

Scan the code and occupy the space , limit 200 Quota , Please wait for the course advisor to pass

Study , endless , I hope you all get something .

Read the original , Learn more about .

版权声明
本文为[58 Shen Jian]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201207062619829d.html