| In order to maintain data consistency among replicas in distributed systems,distributed data services usually use consensus protocol to achieve data consistency.Paxos protocol is one of the most popular consensus protocols,which requires that most nodes in the system are always running.In order to ensure the high availability of distributed systems,the problem of server node failure recovery is particularly important.When a node in a system crashes,it must recover its data and update its state as soon as possible,so it needs an efficient fault recovery algorithm.The existing fault recovery algorithm Full SS persists the node’s logs,snapshots,status information,etc.to the hard disk,solid-state disk,and other stable storage during the normal execution of the system,so that the failed node can read the storage contents to recover its state after restarting;However,frequent use of stable storage will seriously affect system performance.In contrast to Full SS,Epoch SS algorithm uses little stable storage because it mainly relies on communicating with most other nodes in the system to update the state;However,this method will greatly increase the amount of network data transmission of the system,and the failure recovery efficiency will be limited by the network bandwidth,which will affect the system performance.In view of the above problems,this thesis puts forward the following solutions:(1)A fault recovery optimization scheme based on nonvolatile memory(NVM)is proposed.NVM does not lose data when it is down,has large capacity,has the same read-write delay as DRAM,high throughput,and provides direct byte addressable access to memory.These characteristics show the advantages of using NVM to fault recovery.According to the performance characteristics of NVM that can directly address bytes and append writes,this thesis optimizes the design of key recovery data such as snapshots and logs.The key of our research is to design the corresponding storage structure for NVM.We create a file system on an address range named NVM and mount it into the operating system’s file system tree.A memory map(mmap)is then used to map an area of the NVM to its virtual memory,corresponding byte-by-byte to the file system,allowing applications to bypass the existing file system page cache and access the NVM directly.This can reduce the read-write delay during data recovery and shorten the failure recovery time.By balancing the amount of local data storage and the amount of data transmission between nodes,the data snapshot storage strategy is designed.Experimental results show that our optimization scheme based on NVM has better data recovery effect than Full SS and Epoch SS.(2)An optimization strategy of data recovery efficiency based on log entry index is proposed.Snapshot data is appended to NVM.How to retrieve log data quickly to ensure the replay of log entries,and then ensure the node to quickly restore the available state,has become a key research issue.The failed node reads the snapshot from the NVM,and the state machine recovers its state by executing the instances recorded in the snapshot.It contains many instances of state machines that have been executed before node failure,which results in a waste of system resources.In order to avoid the repeated execution of these instances,the index list of log entries is designed and implemented.The list records the correspondence between the instance number and the first request sequence number in each instance,allowing the state machine to skip those instances in the snapshot that have already been executed.Failure nodes can recover state faster,further reduce system failure recovery time and improve data recovery efficiency. |