As a member of the Internet, we are often immersed in the atmosphere of "distribution" - words such as high availability, high reliability, and high performance are everywhere, and nouns such as CAP, BASE, 2PC, Paxos, and Raft are also easy to use. However, some words are gradually misused or ambiguous in our "not rigorous" communication. Today, let's talk briefly about the word "Consistency".
Paxos, Raft, etc. are often mistakenly called "consistency algorithms". However, "consistency" and "consensus" are not the same concept. Paxos, Raft, etc. are actually consensus algorithms. In 1998, Leslie Lamport published an article titled "The Part-Time Parliament"[1] in ACM Transactions on Computer Systems. This was the first time that the Paxos algorithm was publicly published. However, after the publication, many people still felt that the original article was too difficult to understand. Later, Lamport wrote another article titled "Paxos Made Simple"[2]. When we want to learn about Paxos, we can directly read this article. Back to the topic, we search for the word "Consistency" in "Paxos Made Simple". As shown in the figure below, there are actually no matching results. On the other hand, when we searched for the word "Consensus", many matches appeared. In other words, the word Consistency is not mentioned in the entire Paxos paper, so where does the statement "Paxos is a consistency algorithm" come from? Similarly, the Raft paper “In Search of an Understandable Consensus Algorithm (Extended Version)” [3] gives a clear definition of Raft at the beginning: Raft is a consensus algorithm.... Note that the word here is consensus, not consistency. At this point, let's open the dictionary again. At first glance, the translations of Consistency and Consenus in the dictionary are similar, both meaning "consistency", but a closer look reveals that they are different: Consistency: consistency, Consensus: consensus, unanimous opinion. From a professional perspective, what we usually call consistency in a distributed system refers to the consistency of multiple copies of the same data, such as strong consistency, sequential consistency, and eventual consistency, which are all used to describe the consistency in the copy problem. Consensus is different. Simply put, the consensus problem is a process of making multiple nodes reach the same state through a certain algorithm. Consistency emphasizes the result, while consensus emphasizes the process. The book "Distributed Systems Concepts and Design" defines the consensus problem as follows: To reach consensus, each process pi is initially in the undecided state and proposes a value vi from the set D. The processes communicate with each other and exchange values. Then, each process sets the value of a decision variable di. In this case, it enters the decided state. In this state, it no longer changes di. The following figure shows three processes participating in a consensus algorithm. Two processes propose to "continue", and the third process proposes to "give up" but then crashes. The two correct processes both decide to "continue". (Where i = 1, 2, ..., N; j = 1, 2, ..., N.) The consensus algorithm requires that the following conditions be met in each execution:
In the consensus problem, all nodes must eventually reach a consensus. Since the ultimate goal is for all nodes to reach a consensus, there is no distinction between strong and weak consistency. Therefore, when we see similar statements such as "Paxos is a strong consistency algorithm" and "Raft is a strong consistency protocol", we should look at the following content with a "critical" eye. In most of our work, the difference between consistency and consensus is actually insignificant. But if we want to raise a dimension and study the content of the distributed field in depth, then if these most basic concepts are not clearly distinguished, it will greatly hinder the subsequent learning process. The closer the words are, the more they should be clearly distinguished. Even the same word can have different meanings. For example, the C in CAP and ACID both stand for Consistency, but their meanings in their respective scenarios are different.
In general, the C in ACID emphasizes the need to ensure data integrity and correctness during single database transaction operations, while the C in the CAP theory emphasizes the read and write consistency of multiple backups of a data. Do you have anything to say about today’s knowledge points? Feel free to leave your thoughts in the comment section. References http://lamport.azurewebsites.net/pubs/lamport-paxos.pdf http://lamport.azurewebsites.net/pubs/paxos-simple.pdf https://raft.github.io/raft.pdf A brief discussion on CAP and Paxos consensus algorithms The misused word “consistency” Distributed Consensus: Viewstamped Replication, Raft, and Paxos |
<<: Uncovering the Cost of Cyber Attacks in the 5G Era
>>: GSA report: 63 operators around the world have launched commercial 5G services
It is very easy to create a local TCP server, whi...
It is 2019, and there is a serious problem that b...
At the beginning of the year, the tribe shared in...
The 5G network architecture is divided into SA an...
In 2016, Tmall’s single-day sales record was 120....
It is generally acknowledged that DNS occupies bo...
[[337631]] This article is reprinted from the WeC...
[[389476]] After much anticipation, China Unicom ...
According to public data, the scale of layoffs at...
On October 15, Huawei held a press conference tit...
The 5G waves are rising higher and higher. In ear...
Despite the adoption of data center infrastructur...
Are you a 4G die-hard who is unwilling to move? I...
On May 26, 2021, the Beijing stop of the "Se...
"With the advent of the 5G era, mobile commu...