当前位置:网站首页>Masterless Replication System (3)-Limitations of Quorum Consistency
Masterless Replication System (3)-Limitations of Quorum Consistency
2022-07-31 16:39:00 【HUAWEI CLOUD】
若有n个副本,且配置w和r,使得,Expect to read an up-to-date value.Because the successfully written node set and the read node set must coincide,At least one of the nodes thus read has the latest value,如图-11.
一般设定r和w为简单多数(超过n/2)节点,即可确保 w + r> n,且同时容忍多达 n/2 个节点故障.但是,A quorum does not necessarily have to be a majority,It's just that the node intersection for read and write use needs to include at least one node.Other quorum configurations are possible,This allows some flexibility in the design of distributed algorithms.
您也可以将w和r设置为较小的数字,以使(That is, the statutory conditions are not met).在这种情况下,Read and write operations will still be sent ton个节点,But only a small number of successful responses are required for the operation to succeed.
较小的w和rMore likely to read stale data,Because your read is more likely not to contain the node with the latest value.另一方面,This configuration allows for lower latency and higher availability:If there is a network outage,And many copies became inaccessible,There is a greater chance that reads and writes can continue to be processed.Only if the number of reachable replicas is beloww或r时,The database becomes unavailable for writing or reading, respectively.
但是,即使在的情况下,也可能存在返回陈旧值的边缘情况.这取决于实现,But possible situations include:
- If a relaxed quorum is used,wwrite andrreads fall on completely different nodes,因此r节点和wOverlapping nodes are no longer guaranteed between【46】.
- If two writes happen at the same time,不清楚哪一个先发生.在这种情况下,唯一安全的解决方案是合并并发写入(See Handling Write Conflicts).如果根据时间戳(最后写入胜利)Pick a winner,then due to clock skew[35],写入可能会丢失
- 如果写操作与读操作同时发生,Write operations may only be reflected on some replicas.在这种情况下,Not sure if the read returns the old value or the new value.
- If the write operation was successful on some replicas,And fails on other nodes(例如,Because the disk on some nodes is full),在小于wThe write on the replica was successful.Therefore, the overall judgment is that the write fails,But overall write failures are not rolled back on the write-successful replica.This means if a write fails though report,Subsequent reads may still read the value of this failed write【47】.
- If the node carrying the new value fails,Other replicas with old values need to be read.And its data is restored from the copy with the old value,then the number of replicas storing the new value may be lowerw,thereby breaking the quorum condition.
- 即使一切工作正常,Occasionally, unfortunately, about时序(timing) 的边缘情况
因此,Although quorum seems to guarantee that reads return the latest written value,But in practice it's not that simple. DynamoStyle databases are usually optimized for use cases that can tolerate eventual consistency.允许通过参数w和rto adjust the probability of reading stale values,But it is unwise to take them as absolute guarantees.
尤其是,Because usually don't get it“复制延迟问题”guarantees discussed in (读己之写,单调读,一致前缀读),The aforementioned exceptions can occur in applications.Stronger guarantees are usually required事务或共识.我们将在第七章和第九章Back to these topics.
4.2.1 监控旧值
运维角度,监视DBWhether or not the latest result is returned is important.Even if the application can tolerate reading old values,You also need to know the current health of the replication.If noticeably delayed,就是信号,The reason needs to be investigated(Such as network problems or node overload).
Master-slave replication system,DBMetrics for replication lag are often exported,It can be integrated into monitoring systems.因为主、Writes from slave nodes follow the same order,Instead, each node maintains the current offset of the replication log execution. By contrast to the main、The current offset value from the node,You can measure the degree to which the slave node lags behind the master node.
Masterless replication system,There is no fixed write order,Monitoring is therefore more difficult.And if the database only uses read repair(No anti-entropy process),Then there is no upper limit to the backwardness of the old value.For example if a value is rarely accessed,then the old value returned may be very old!
A study to measure masterless replicated databases,根据参数n,w和rto predict the expected percentage of old value reads.不幸的是,This is not common practice yet,But it's a good trend to include old measurements in the database's metric set.Eventual consistency is a vague guarantee,operability angle,Energize“最终”很有价值.
边栏推荐
猜你喜欢
Qt实战案例(54)——利用QPixmap设计图片透明度
Huawei's top engineers lasted nine years "anecdotal stories network protocol" PDF document summary, is too strong
adb shell 报错error: device unauthorized
SringMVC中个常见的几个问题
type of timer
基于ABP实现DDD
【7.29】Code Source - 【Arrangement】【Stone Game II】【Cow and Snacks】【Minimum Number of Spawns】【Sequence】
【TypeScript】深入学习TypeScript类型操作
tooltips使用教程(鼠标悬停时显示提示)
利用PHP开发具有注册、登陆、文件上传、发布动态功能的网站
随机推荐
adb shell error error: device unauthorized
阿里三面:MQ 消息丢失、重复、积压问题,如何解决?
tooltips使用教程(鼠标悬停时显示提示)
Flutter 获取状态栏statusbar的高度
.NET 20周年专访 - 张善友:.NET 技术是如何赋能并改变世界的
.NET 20th Anniversary Interview - Zhang Shanyou: How .NET technology empowers and changes the world
动态规划(一)
go图书管理系统
What is the difference between BI software in the domestic market?
网站漏洞修复服务商关于越权漏洞分析
6-22 Vulnerability exploit - postgresql database password cracking
Intelligent bin (9) - vibration sensor (raspberries pie pico implementation)
C程序是如何跑起来的01 —— 普通可执行文件的构成
多主复制下处理写冲突(4)-多主复制拓扑
【愚公系列】2022年07月 Go教学课程 021-Go容器之切片操作
智能垃圾桶(八)——红外对管传感器(树莓派pico)
Flutter set the background color of the statusbar status bar and APP method (AppBar) internal consistent color.
第二届中国PWA开发者日
华为顶级工程师历时9年总结的“趣谈网络协议”PDF文档,太强了
你辛辛苦苦写的文章可能不是你的原创