background
An unavoidable problem in the design of distributed system clusters is the consistency problem
For multiple service nodes in the system, given a series of operations, how to try to achieve a certain degree of agreement between the global and the local processing results?
This consistency problem roughly has the following scenarios:
Unreliable communication between nodes, delayed and blocked
The processing of the node may be wrong, or even the node itself may be down at any time
Node evil
For example, for example, there are two movie theaters selling a certain amount of movie tickets at the same time. In such a scenario, how to design a way to ensure that the two movie theaters coordinate and synchronize without oversold or mis-sell problems?
Consensus algorithm is a process for everyone to reach consensus on a certain proposal (goal, voting, etc.)
For example, the above ticket purchase problem can be designed as follows:
Call other cinemas every time you sell tickets to confirm the current number of tickets
Negotiate the sale time, such as selling at 135A and selling at 246B
Establish a third-party invoice deposit institution, which unifies invoices
Through the above design, we can see a very important solution idea to solve the consistency algorithm, namely:
Serializing parallel operations that may cause inconsistency is the basic idea and the only secret for dealing with distributed consistency issues in computer systems.