Content
First, let's think about a question first, why is the maximum number of fault-tolerant nodes of the pbft algorithm (n-1)/3, and the maximum number of fault-tolerant nodes of the raft algorithm is (n-1)/2?
For the raft algorithm, the fault tolerance of the raft algorithm only supports fault-tolerant fault nodes, not fault-tolerant nodes. What is a faulty node? It is a node that does not respond due to other abnormal conditions such as system busy, downtime, or network problems. The node that has this situation is the faulty node. So what is a malicious node? In addition to deliberately not responding to requests from other nodes in the cluster, the malicious node can also deliberately send wrong data, or send different data to different other nodes, so that the nodes of the entire cluster cannot finally reach a consensus. This kind of node is Evil node.
The raft algorithm only supports fault-tolerant nodes. Assuming that the total number of nodes in the cluster is n and the number of faulty nodes is f, according to the principle that decimals obey the majority, normal nodes in the cluster only need one more node than f nodes, that is, f+1 nodes. The number of correct nodes will be more than the number of failed nodes, then the cluster can reach a consensus. Therefore, the maximum number of fault-tolerant nodes supported by the raft algorithm is (n-1)/2.
For the pbft algorithm, because the pbft algorithm needs to support fault-tolerant nodes as well as fault-tolerant nodes. Suppose the number of cluster nodes is N, and the problematic node is f. The problematic node can be either a faulty node or a malicious node, or only a faulty node or just a malicious node. Then there will be the following two extreme situations:
In the first case, the f problematic nodes are both faulty nodes and malicious nodes. Then, according to the principle of the majority of decimals, normal nodes in the cluster only need one more node than f nodes, that is, f+1 nodes. The number of nodes will be more than the number of failed nodes, then the cluster can reach a consensus. In other words, the maximum number of fault-tolerant nodes supported in this case is (n-1)/2.
In the second case, the faulty node and the malicious node are different nodes. Then there will be f problematic nodes and f faulty nodes. When a node is found to be a problem node, it will be excluded by the cluster, and there are f faulty nodes. Then, according to the principle of majority, the normal nodes in the cluster only need If there are f nodes and one more node, that is, f+1 nodes, the number of nodes will be more than the number of faulty nodes, then the cluster can reach a consensus. Therefore, the total number of nodes of all types is f+1 correct nodes, f faulty nodes and f problem nodes, namely 3f+1=n.