当前位置:网站首页>复制延迟案例(3)-单调读
复制延迟案例(3)-单调读
2022-07-31 15:27:00 【华为云】
前面异步复制读异常的第二个案例,出现用户数据向后回滚的怪状。
若用户从不同【从节点】多次读取,就可能这样。如图-4显示用户2345两次进行相同查询:
- 首先查询延迟很小的从节点
- 然后是延迟较大的从节点
若用户刷新网页,而每个请求被路由到一个随机的服务器,这种情况是很有可能的。
第一个查询返回最近由用户1234添加的评论,但第二个查询不返回任何东西,因为滞后的从节点还没有拉取写入的内容。效果上相比第一个查询,第二个查询是在更早的时间点来观察系统。
- 若第一个查询未返回任何内容,则问题不大,因为用户2345可能不知道用户1234最近添加了评论
- 但若用户2345先看见用户1234的评论,然后又看到它消失,则对用户2345,就会感觉头大

单调读保证这种异常不会发生。这是比强一致性(strong consistency)弱,但比最终一致性强的保证。当读取数据时,可能会看到一个旧值;单调读取仅意味着若一个用户顺序多次读取,则不会看到时间后退,即若先前读取到较新的数据,后续读取不会得到更旧数据。
实现单调读取的一种方案:确保每个用户总从同一副本读取(不同用户可读不同副本)。如基于用户ID散列选择副本,而非随机选择副本。但若该副本失败,用户的查询将需重新路由到另一个副本。
边栏推荐
- Gorm—Go语言数据库框架
- R language ggplot2 visualization: use the ggboxplot function of the ggpubr package to visualize the box plot, use the font function to customize the font size, color, style (bold, italic) of the legen
- Linux查看redis版本(查看mongodb版本)
- WPF项目--控件入门基础用法,必知必会XAML
- 微信聊天记录中搜索红包
- mongo enters error
- Codeforces Round #796 (Div. 2) (A-D)
- MySQL的相关问题
- BGP综合实验(建立对等体、路由反射器、联邦、路由宣告及聚合)
- The use of border controls
猜你喜欢
随机推荐
R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(caption、添加、修改可视化图像的题注、脚注内容)
R language moves time series data forward or backward (custom lag or lead period): use the lag function in the dplyr package to move the time series data forward by one day (set the parameter n to a p
JVM parameter analysis Xmx, Xms, Xmn, NewRatio, SurvivorRatio, PermSize, PrintGC "recommended collection"
国内市场上的BI软件,到底有啥区别
网银被盗?这篇文章告诉你如何安全使用网银
mysql黑窗口~建库建表
abaqus find contact pairs报错:surface name is already in use
Implement anti-shake and throttling functions
华医网冲刺港股:5个月亏2976万 红杉与姚文彬是股东
思路迪医药冲刺港股:5个月亏2.9亿 泰格医药与先声药业是股东
button控件的使用
How useful is four-quadrant time management?
Ubantu专题4:xshell、xftp连接接虚拟机以及设置xshell复制粘贴快捷键
Selenium自动化中无头浏览器的应用
leetcode303场周赛复盘
Internet banking stolen?This article tells you how to use online banking safely
Efficient use of RecyclerView Section 1
工程流体力学复习
R language ggplot2 visualization: use the ggmapplot function of the ggpubr package to visualize the MA plot (MA-plot), the font.legend parameter and the font.main parameter to set the title and legend
01 Encounter typescript, build environment








