Raft is a leading consensus algorithm for replicating writes in distributed databases. However, distributed databases also require consistent reads. To guarantee read consistency, a Raft-based system must either accept the high communication overhead of a safety check for each read, or implement leader leases. Prior lease protocols are vaguely specified and hurt availability, so most Raft systems implement them incorrectly or not at all. We introduce LeaseGuard, a novel lease algorithm that relies on guarantees specific to Raft elections. LeaseGuard is simple, rigorously specified in TLA+, and includes two novel optimizations that maximize availability during leader failover. The first optimization restores write throughput quickly, and the second improves read availability. We evaluate LeaseGuard with a simulation in Python and an implementation in LogCabin, the C++ reference implementation of Raft. By replacing LogCabin's default consistency mechanism (quorum checks), LeaseGuard reduces the overhead of consistent reads from one to zero network roundtrips. It also improves write throughput from ~1000 to ~10,000 writes per second, by eliminating contention between writes and quorum reads. Whereas traditional leases ban all reads on a new leader while it waits for a lease, in our LeaseGuard test the new leader instantly allows 99% of reads to succeed.


翻译:Raft是分布式数据库中实现写入复制的领先共识算法。然而,分布式数据库同样需要一致性读取。为保证读取一致性,基于Raft的系统要么必须承受每次读取安全检查带来的高通信开销,要么需要实现领导者租约机制。现有租约协议规范模糊且会损害可用性,因此大多数Raft系统要么错误实现该机制,要么完全未实现。本文提出LeaseGuard——一种基于Raft选举特定保障的新型租约算法。该算法设计简洁,通过TLA+形式化规范严格定义,并包含两项最大化领导者故障转移期间可用性的创新优化:第一项优化可快速恢复写入吞吐量,第二项优化则提升读取可用性。我们通过Python模拟实验和LogCabin(Raft的C++参考实现)中的部署对LeaseGuard进行评估。通过替换LogCabin默认的一致性机制(法定人数检查),LeaseGuard将一致性读取的开销从一次网络往返降至零。同时通过消除写入与法定人数读取之间的竞争,将写入吞吐量从约1000次/秒提升至约10000次/秒。传统租约机制要求新领导者在等待租约期间禁止所有读取操作,而在我们的LeaseGuard测试中,新领导者能立即允许99%的读取请求成功执行。

0
下载
关闭预览

相关内容

Stanford的Diego Ongaro和John Ousterhout提出了Raft算法,这是一个更容易理解的分布式一致性算法,在算法的论文中,不仅详细描述了算法,甚至给出了RPC接口定义和伪代码,这显然更加容易应用到工程实践中。
【ICML2022】XAI for Transformers:通过保守传播更好的解释
专知会员服务
16+阅读 · 2022年7月19日
专知会员服务
16+阅读 · 2021年5月21日
【NeurIPS2019】图变换网络:Graph Transformer Network
Shreya Gherani:BERT庖丁解牛(Neo Yan翻译)
CreateAMind
10+阅读 · 2019年8月10日
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
Arxiv
0+阅读 · 12月23日
VIP会员
相关基金
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
Top
微信扫码咨询专知VIP会员