容错技术是分布式系统的重要组成部分,确保了发生故障时的系统连续性和功能性[1]。近年来,随着分布式系统规模的不断扩大、分布式架构和计算复杂度的日益增加[2]以及廉价商业硬件的广泛使用,使得计算任务发生故障的概率持续增加,例如在Google生产集群中平均每天会有数十个节点发生故障[3]。瞬态故障尤其是软错误[4]会导致计算机系统的异常行为,这类故障会损坏数据的完整性,引起分布式节点的计算失效[4-5]。在一些大型分布式系统中平均每天会有1%~2%的节点发生失效[6],因此容错技术可在保证部分节点失效的情况下,使分布式系统仍能继续运行且得到正确结果[7-9]。在基于MapReduce[10]的分布式计算中,数据洗牌(shuffle)阶段较高的通信开销严重影响了分布式计算性能,例如在Facebook的Hadoop集群中,33%的任务执行总时间用于数据洗牌阶段[11]。针对基于MapReduce分布式计算框架的多副本容错算法通信开销较大的问题,本文提出一种结合分布式编码计算的容错算法CTMR,使基于MapReduce的分布式计算系统在发生瞬态故障的情况下仍能继续运行且得到正确结果,同时能有效降低容错计算过程中的通信开销。
1 相关工作基于多副本冗余技术[12-15]的分布式容错算法于1962年由IBM提出,但在现代分布式系统中仍然被广泛采用[16-17]。这类算法的主要思想是:在含有
通信开销是基于MapReduce的分布式计算中的主要性能瓶颈,这是因为在数据洗牌阶段交换大量中间结果。为解决该问题,文献[7]提出分布式编码计算方法,将map任务重复布置到多个不同的节点,通过增加计算冗余创建同时满足多个服务器数据需求的编码数据来降低通信开销。在一个分布式集群中,
假设在分布式集群中有N个节点,标记为
$ \frac{M\cdot r}{N}\cdot (r-1)\cdot \frac{1}{c}=N-Q $ | (1) |
reduce节点对接收到的编码中间结果进行解码,通过校验识别发生故障的编码数据包,并利用冗余中间结果得到M份数据最终正确的计算结果,如式(2)所示:
$ Q\cdot \frac{M\cdot r}{N}=M $ | (2) |
因为本文算法随机选取Q个reduce节点均能够完成所有中间结果的验证,所以节点应该包含编码数据所有可能的中间结果,如式(3)所示:
$ \left(\begin{array}{l}M/c\\ \frac{M\cdot r}{N}\cdot \frac{1}{c}\end{array}\right)=N $ | (3) |
由于TMR的低复杂度及高可靠性,因此本文选取
在包含N个节点的分布式集群中,将每6个节点分为1个子集群,共有
![]() |
Download:
|
图 1 CTMR模型 Fig. 1 CTMR model |
两个邻近节点
$ {u}_{k, m}=\oplus {b}_{i}, {b}_{i}\in {R}_{k, m} $ | (4) |
其中,
将一个包含N个节点的分布式集群划分为
随机选取一个节点
算法1 数据分发与中间结果编码算法
输入 Dataset B
输出 各个节点的编码中间结果
1.for each
2.distribute
3.
4.end for
5.select two check nodes
6.for each
7.if
8.
9.
10.send
11.end for
$ \left\{\begin{array}{l}({u}_{s, k}={u}_{k, s})\wedge ({u}_{n, k}={u}_{k, n})\\ ({u}_{p, k}={u}_{k, p})\wedge ({u}_{q, k}={u}_{k, q})\end{array}\right. $ | (5) |
若式(5)中两个等式均不成立,而式(6)两个等式中的任意一个成立,则假设
$ \left\{\begin{array}{l}({u}_{s, k}={u}_{k, s})\vee ({u}_{n, k}={u}_{k, n})\\ ({u}_{p, k}={u}_{k, p})\vee ({u}_{q, k}={u}_{k, q})\end{array}\right. $ | (6) |
若式(7)成立,则表明
$ {u}_{q, k}\oplus {v}_{i}^{k}\oplus {u}_{p, k}\oplus {v}_{j}^{k}={u}_{k, s} $ | (7) |
若
算法2 故障检测与恢复算法
输入 各个节点的编码中间结果U,
输出 子集群的reduce结果
1.for
2.if
3.if one of the formula(5)is true do//如果校验节点所在//面有一组对边校验成功
4.
5.else if one of the formula(6)is true do//如果校验节点//有一条边验证成功
6.assume
4.if formula(7)is true do//如果通过当前校验成功的边//验证收到的其他编码中间结果正确,则证明当前节点有中间//结果计算错误
8.
9.else goto step 6//重新选取校验节点进行故障检测与//恢复
10.if
11.
12.return r
在随机选取子集群中的两个reduce节点后,每次TMR算法验证都需发送16份中间结果给reduce节点,假设每个中间结果大小为
$ \frac{1}{2}\le \frac{{L}_{\mathrm{C}\mathrm{T}\mathrm{M}\mathrm{R}}}{{L}_{\mathrm{T}\mathrm{M}\mathrm{R}}}\le 1 $ | (8) |
如图 2所示,在含有
![]() |
Download:
|
图 2 node1中 |
本文分布式计算的测试程序为Terasort[22],CTMR算法的评价指标为任务执行总时间、map和shuffle阶段执行时间以及平均故障修复时间(Mean Time to Repair,MTTR),对比算法为TMR和two-stage TMR算法。
实验使用多台虚拟机搭建的分布式集群,包括1个管理节点和6个工作节点,节点间的带宽为100 Mb/s。实验中动态选择发生故障的节点个数,随机选取节点并修改其对应数据块数值实现故障注入。假设系统在单位时间内的故障发生概率服从泊松分布
$ T=\sum {t}_{k}\cdot p\left(k\right) $ | (9) |
故障修复时间为检测到故障直至故障修复的时间,假设有k个故障时的故障修复时间为
$ {T}_{\mathrm{M}\mathrm{T}\mathrm{T}\mathrm{R}}=\sum {\theta }_{k}\cdot p\left(k\right) $ | (10) |
实验中每个MapReduce任务可以分为map、shuffle、check和reduce这4个阶段。在map阶段,管理节点按照CTMR算法要求将用户输入数据分发给6个工作节点,同时指定2个校验节点。每个工作节点对本地数据集进行排序,得到相应的中间结果集。在shuffle阶段,每个节点将其中间结果编码,发送给之前指定的校验节点。在check阶段,校验节点将收到的数据包进行故障检测和恢复,校验成功后得到相应结果。在reduce阶段,管理节点收到校验节点发送来的部分reduce计算结果后执行reduce函数得到最终输出结果。任务执行总时间
$ {T}_{\mathrm{t}\mathrm{o}\mathrm{t}\mathrm{a}\mathrm{l}}={T}_{\mathrm{m}\mathrm{a}\mathrm{p}}+{T}_{\mathrm{s}\mathrm{h}\mathrm{u}\mathrm{f}\mathrm{f}\mathrm{l}\mathrm{e}}+{T}_{\mathrm{c}\mathrm{h}\mathrm{e}\mathrm{c}\mathrm{k}}+{T}_{\mathrm{r}\mathrm{e}\mathrm{d}\mathrm{u}\mathrm{c}\mathrm{e}} $ | (11) |
图 3给出了CTMR、two-stage TMR以及TMR算法的任务执行总时间对比结果。可以看出,CTMR算法能有效降低分布式计算的任务执行总时间。当故障个数较少时,CTMR算法的执行效率远高于另外两种算法。随着故障个数的不断增加,two-stage TMR算法由于需要重新执行第3个副本做验证,而CTMR算法则需要更换节点做验证,在该过程中需要重新发送编码数据包,因此这两种算法的任务执行总时间也会随之增加。
![]() |
Download:
|
图 3 任务执行总时间对比 Fig. 3 Comparison of total task execution time |
图 4给出了CTMR、two-stage TMR以及TMR算法在map阶段的执行时间对比结果。可以看出,随着故障个数的增加,two-stage TMR算法由于第1次投票选择的2个副本对应的中间结果不同,因此需要进行第2次投票。这时会选择第3个副本并执行map任务,因此map阶段所需时间随故障个数的增加不断增加。TMR和CTMR算法由于最初都要对3个副本执行map任务,因此map阶段的执行时间基本保持不变。
![]() |
Download:
|
图 4 map阶段执行时间对比 Fig. 4 Comparison of the execution time in the map phase |
图 5给出了CTMR、two-stage TMR以及TMR算法在shuffle阶段的执行时间对比结果。可以看出,CTMR算法在shuffle阶段所需时间明显低于TMR算法,并且相比two-stage TMR算法有一定程度的减少。本文将shuffle阶段的执行时间作为通信开销的衡量指标,当系统在单位时间内的故障发生概率服从泊松分布
![]() |
Download:
|
图 5 shuffle阶段执行时间对比 Fig. 5 Comparison of the execution time in the shuffle phase |
图 6给出了CTMR、two-stage TMR以及TMR算法在check阶段的执行时间对比结果。可以看出,CTMR算法在一定的故障个数范围内,故障修复效率明显优于TMR与two-stage TMR算法。随着故障个数的不断增加,TMR和two-stage TMR算法均需要对所有副本进行第3次投票,而CTMR算法也需要更换节点进行校验,因此3种算法的故障恢复时间不断增加并最终趋于一致。
![]() |
Download:
|
图 6 check阶段执行时间对比 Fig. 6 Comparison of the execution time in the check phase |
当系统在单位时间内发生故障的概率服从泊松分布时,根据式(9)分别计算出CTMR、two-stage TMR以及TMR算法在tatal阶段的任务执行总时间以及map、shuffle和check阶段的任务执行时间,结果如图 7所示。可以看出,CTMR算法的任务执行总时间相比TMR算法降低了25.8%,相比two-stage TMR算法降低了13.2%。根据式(10),CTMR算法的平均故障修复时间相比TMR算法降低了18.3%,相比two-stage TMR算法降低了26.2%。
![]() |
Download:
|
图 7 故障发生概率服从泊松分布时3种算法的执行时间对比 Fig. 7 Comparison of the execution time of the three algorithms when the probability of failure obeys the Poisson distribution |
为降低MapReduce分布式计算中容错算法的通信开销,本文结合副本冗余技术和分布式编码计算技术,提出一种新的容错算法。实验结果表明,CTMR算法在完成容错计算的同时,相比TMR和two-stage TMR容错算法,平均降低了41.0%和14.0%的shuffle阶段的通信开销以及18.3%和26.2%的平均故障修复时间,并且提高了分布式系统的可用性和可靠性。但由于本文中的副本数量固定为3具有一定的局限性,因此下一步将根据分布式系统的故障发生概率,通过动态调整副本数量以增强容错算法的灵活性。
[1] |
SARI A, AKKAYA M. Fault tolerance mechanisms in distributed systems[J]. International Journal of Communica-tions, Network and System Sciences, 2015, 8(12): 471-482. DOI:10.4236/ijcns.2015.812042 |
[2] |
MARIANI L, PEZZE M, RIGANELLI O. Predicting failures in multi-tier distributed systems[EB/OL]. [2020-02-15]. https://arxiv.org/abs/1911.09561.
|
[3] |
ITANI M, SHARAFEDDINE S, ELKABANI I. Dynamic single node failure recovery in distributed storage systems[J]. Computer Networks, 2017, 113: 84-93. DOI:10.1016/j.comnet.2016.12.005 |
[4] |
GUO Baolong, WANG Jian, YAN Yunyi, et al. Optimal design of DSP protection based on multi-target PSO algorithm[J]. Computer Engineering, 2018, 44(4): 74-80. (in Chinese) 郭宝龙, 王健, 闫允一, 等. 基于多目标PSO算法的DSP防护优化设计[J]. 计算机工程, 2018, 44(4): 74-80. DOI:10.3969/j.issn.1000-3428.2018.04.012 |
[5] |
LEI Changjian, LIN Yaping, LI Jinguo, et al. Research on Byzantine fault tolerance under volunteer cloud environ-ment[J]. Computer Engineering, 2016, 42(5): 1-7. (in Chinese) 雷长剑, 林亚平, 李晋国, 等. 志愿云环境下的拜占庭容错研究[J]. 计算机工程, 2016, 42(5): 1-7. |
[6] |
BERROCAL E, BAUTISTA-GOMEZ L, DI S, et al. Toward general software level silent data corruption detection for parallel applications[J]. IEEE Transactions on Parallel and Distributed Systems, 2017, 28(12): 3642-3655. DOI:10.1109/TPDS.2017.2735971 |
[7] |
LI S Z, MADDAH-ALI M A, QIAN Y, et al. A fundamental tradeoff between computation and communication in dis-tributed computing[J]. IEEE Transactions on Information Theory, 2018, 64(1): 109-128. DOI:10.1109/TIT.2017.2756959 |
[8] |
REISIZADEH A, PRAKASH S, PEDARSANI R, et al. Coded computation over heterogeneous clusters[J]. IEEE Transactions on Information Theory, 2019, 65(7): 4227-4242. DOI:10.1109/TIT.2019.2904055 |
[9] |
KONSTANTINIDIS K, RAMAMOORTHY A. Leveraging coding techniques for speeding up distributed computing[C]//Proceedings of 2018 IEEE Global Communications Conference. Washington D.C., USA: IEEE Press, 2018: 1-6.
|
[10] |
DEAN J, GHEMAWAT S. MapReduce: simplified data processing on large clusters[J]. Communications of the ACM, 2008, 51(1): 107-113. DOI:10.1145/1327452.1327492 |
[11] |
LI S Z, QIAN Y, MADDAH-ALI M A, et al. Coded distributed computing: fundamental limits and practical challenges[C]//Proceedings of the 50th Asilomar Conference on Signals, Systems and Computers. Washington D.C., USA: IEEE Press, 2016: 509-513.
|
[12] |
D'ANGELO G, FERRETTI S, MARZOLLA M. Fault tolerant adaptive parallel and distributed simulation through functional replication[J]. Simulation Modelling Practice and Theory, 2019, 93: 192-207. DOI:10.1016/j.simpat.2018.09.012 |
[13] |
LEDMI A, BENDJENNA H, HEMAM S M. Fault tolerance in distributed systems: a survey[C]//Proceedings of the 3rd International Conference on Pattern Analysis and Intelligent Systems. Washington D.C., USA: IEEE Press, 2018: 1-5.
|
[14] |
LIAO Weicheng, WU Janjan. Replica-aware job scheduling in distributed systems[C]//Proceedings of Advances in Grid and Pervasive Computing. Berlin, Germany: Springer, 2010: 290-299.
|
[15] |
BARKAHOUM K, HAMOUDI K. A fault-tolerant scheduling algorithm based on check pointing and redundancy for distributed real-time systems[J]. International Journal of Distributed Systems and Technologies, 2019, 10: 58-75. DOI:10.4018/IJDST.2019070104 |
[16] |
LYONS R E, VANDERKULK W. The use of triple-modular redundancy to improve computer reliability[J]. IBM Journal of Research and Development, 1962, 6(2): 200-209. DOI:10.1147/rd.62.0200 |
[17] |
FU M, HAN S J, LEE P P C, et al. A simulation analysis of redundancy and reliability in primary storage deduplication[J]. IEEE Transactions on Computers, 2018, 67(9): 1259-1272. DOI:10.1109/TC.2018.2808496 |
[18] |
SALEHI M, KHAVARI TAVANA M, REHMAN S, et al. Energy-efficient permanent fault tolerance in hard real-time systems[J]. IEEE Transactions on Computers, 2019, 68(10): 1539-1545. DOI:10.1109/TC.2019.2912164 |
[19] |
XU Wenfang, LIU Hongwei, SHU Yanjun, et al. Management board for triple module redundant fault-tolerance system[J]. Journal of Tsinghua University(Science and Technology), 2011, 51(S1): 1434-1439. (in Chinese) 徐文芳, 刘宏伟, 舒燕君, 等. 三模冗余容错系统管理板[J]. 清华大学学报(自然科学版), 2011, 51(S1): 1434-1439. |
[20] |
ZHOU Ao, WANG Shangguang, CHENG Bo, et al. Cloud service reliability enhancement via virtual machine placement optimization[J]. IEEE Transactions on Services Computing, 2017, 10(6): 902-913. DOI:10.1109/TSC.2016.2519898 |
[21] |
LI Xin, LIN Yufei, GUO Xiaowei. A triple modular eager redundancy fault-tolerant technique for distributed stream architecture[J]. Computer Engineering and Science, 2015, 37(12): 2233-2241. (in Chinese) 李鑫, 林宇斐, 郭晓威. 面向分布式流体系结构的多副本积极容错技术[J]. 计算机工程与科学, 2015, 37(12): 2233-2241. |
[22] |
O'MALLEY O. TeraByte sort on Apache Hadoop[EB/OL]. [2020-02-15]. http://sortbenchmark.org/YahooHadoop.pdf.
|