| Ensuring consistency in distributed systems is a significant challenge in modern data centers.Existing consensus algorithms mostly rely on replication for log replication,which inevitably introduces high network and storage costs to the server cluster.RS-Paxos was the first consensus algorithm to propose the use of erasure codes to reduce network and storage costs.However,the introduction of erasure codes also reduced the liveness level of the consensus system.Subsequently,researchers proposed the CRaft consensus algorithm to address this issue.In a consensus system that uses erasure codes for log synchronization,when a leader node fails,the new leader node needs to recover the original log through decoding.When recovery reads are required,the new leader node also needs to receive sufficient log fragments from nodes in other racks for recovery reads.Crossrack data transfer significantly degrades the performance of the entire system.By introducing rack awareness into the consensus algorithm and considering the network topology of rackbased server environments during log synchronization,and taking into account both replica and erasure code-based log synchronization methods,it is possible to minimize cross-rack data transfer during recovery reads.In response to this problem,this study proposes the RackRaft distributed consensus algorithm,which considers how to optimize the log synchronization process in rack-based server environments using rack awareness.In RackRaft,the leader node utilizes rack awareness to employ different log synchronization strategies for nodes in different rack relationships,and when designing coding configurations,it considers the number of nodes in a single rack to minimize the need for cross-rack data transfer during recovery reads.In a consensus system constructed using the Rack-Raft algorithm,during log synchronization,the leader node transmits complete log replicas to nodes in the same rack,while for nodes in other racks,the leader node transmits encoded log fragments.Although Rack-Raft theoretically increases network and storage costs compared to RS-Paxos and CRaft,it does not significantly impact write latency because the bandwidth for intra-rack transmission is much greater than cross-rack transmission.Rack-Raft utilizes erasure codes to reduce network and storage costs,and improves the system’s data throughput.In addition,Rack Raft introduces a rack awareness mechanism in log synchronization to make it more suitable for the characteristics of rack servers.The experimental results show that Rack-Raft performs better than other consistency algorithms in a rack server environment.In order to evaluate the performance of Rack Raft,this study constructed a key value storage system based on Rack Raft.The experimental results show that in a rack server environment,compared to the Raft algorithm,Rack-Raft has achieved significant improvements in write latency,network cost,storage cost,and throughput.Compared with the consistency algorithms CRAFT and Rs Paxos,which fully use erasure correction codes for log synchronization,Rack-Raft to some extent reduces the read latency caused by recovery reads. |