计算机与现代化 ›› 2020, Vol. 0 ›› Issue (12): 1-8.

• 算法设计与分析 •    下一篇

LC-Raft:一种基于历史日志计算值的一致性算法

  

  1. (1.中国科学院声学研究所国家网络新媒体工程技术研究中心,北京100190;2.中国科学院大学,北京100049)
  • 出版日期:2021-01-07 发布日期:2021-01-07
  • 作者简介:马博韬(1992—),男,福建厦门人,博士研究生,研究方向:容器虚拟化,分布式系统,智能调度优化,E-mail: mabt@dsp.ac.cn; 倪宏(1964—),男,研究员,研究方向:宽带多媒体通信,网络新媒体,嵌入式系统及中间件,E-mail: nih@dsp.ac.cn; 通信作者:朱小勇(1982—),男,研究员,博士,研究方向:嵌入式系统,多媒体,E-mail: zhuxy@dsp.ac.cn。
  • 基金资助:
    中国科学院战略性科技先导专项课题(XDC02070100)

LC-Raft: A Consensus Algorithm Based on Calculated Value of Historical Log

  1. (1. National Network New Media Engineering Research Center, Institute of Acoustics, Chinese Academy of Sciences, Beijing 100190, China;
    2. University of Chinese Academy of Sciences, Beijing 100049, China)

  • Online:2021-01-07 Published:2021-01-07

摘要: Raft一致性算法由于其原理清晰、易于实现等优点,已得到了行业的广泛应用。然而,作为一种简化版的类Paxos方案,Raft算法牺牲了部分性能。在不同的具体应用场景中,可根据实际应用,对其做出相应改进。对于由稳定性不佳的设备构成的分布式系统,在工作周期内将经历多次选举管理节点过程。在每次选举过程中,继续使用Raft算法进行选举操作将存在小概率经历多次超时选举。为了减少极端情况下选举过程的耗时,本文基于历史日志计算值设计一种改进版一致性算法LC-Raft。通过对固定时段的历史日志故障次数统计,构建一套节点稳定性评价指标,并修改选举流程,实现在系统网络通畅情况下最多经历一次计时器时间完成管理节点选举。同时,基于Docker容器引擎,设计一系列模拟实验实现各种节点规模的选举过程,通过多次实验的统计值验证本算法在选举过程中的良好性能。

关键词: 一致性算法, Raft, 选举过程, 超时选举, 历史日志

Abstract: Raft consensus algorithm has been widely used in the industry because of its clear principle and easy implementation. However, as a simplified version of the Paxos-like solution, the Raft algorithm sacrifices part of its performance. In different specific application scenarios, some aspects can be improved according to the actual application. For a distributed system composed by devices with poor stability, it will go through multiple election processes in the working cycle. In each election process, there is a small probability that the election operation based on Raft algorithm will experience multiple timeout elections. In order to reduce the time-consuming of the election process in extreme cases, this paper designs an improved version of the consensus algorithm LC-Raft. By counting the number of failures in the history log, a set of node stability evaluation indicators are constructed, and the election process is modified. Based on these above steps, the algorithm is able to realize that the election process can be completed before timeout when the system network is unblocked. At the same time, based on the Docker container engine, a series of simulation experiments are designed to realize the election process of different node sizes. Multiple statistical data can verify the good performance of the algorithm in the election process.

Key words: consensus algorithm, Raft, election process, timeout election, history log