本文介绍了“没有任何进一步的写入"是什么?在documentDb最终一致性模型中意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

documentDb文档(位于 https://docs. microsoft.com/en-us/azure/documentdb/documentdb-consistency-levels )中包含以下信息:

最终:最终的一致性保证了在没有任何进一步写操作的情况下,组中的副本最终将收敛.

没有进一步的写信是什么意思?

让我们说我的写操作用W(x,s1,t1)表示,其中x是记录/文档,并在时间1将其更新为状态1.这是我的写事件序列:

W(A,s1,t1),W(B,s1,t1),W(B,s2,t2),W(C,s1,t3)其中t1 <1. t2 < t3与t3-t1 = 100毫秒(例如).

1)是否将更改分别传播到每个记录A,B,C的其他副本?如果是这样,每个记录是否需要等待一段时间才能检测给定记录的更新流?

2)是否仅在t3之后的某个时间(tn)(表示写入结束)之后才开始将更改传播到每个记录A,B,C的其他副本?

3)假设我只有W(A,s1,t1)并且不再为任何记录写任何事件,通常需要多长时间将记录A的更改传播给所有记录副本? ( AWS Dynamodb声称这是在一秒钟之内;我没有发现对documentDb的任何此类索赔)

解决方案

DocumentDB中的复制没有内置的内部延迟.在单区域配置中,实际上两个副本之间最多相隔几毫秒.在多区域设置中,是区域之间的网络(光速")滞后加上一些计算开销.

文档之所以说有一段时间",是因为此延迟取决于您的拓扑和网络分区.在网络分区的情况下,最终的一致性会优先考虑可用性而不是一致性(陈旧性),因此副本可能会落在后面.

DocumentDB最终一致性的实现保证了一致性读取的可能性很高(请参阅 http://pbs.cs .berkeley.edu/).如果您需要更强的保证,则可以选择诸如Session,BoundedStaleness或Strong的一致性级别.

The documentDb documentation (at https://docs.microsoft.com/en-us/azure/documentdb/documentdb-consistency-levels) has following information in it:

Eventual:Eventual consistency guarantees that in absence of any further writes, the replicas within the group will eventually converge.

What does absence of any further writes mean?

Lets say that I represent my write operation as W(x, s1, t1) where x is the record/document, updating it to state 1 at time 1. Here are my sequence of write events:

W(A, s1, t1), W(B, s1, t1), W(B, s2, t2), W(C, s1, t3) where t1 < t2 < t3 with t3-t1 = 100 milliseconds (say).

1) Do propagation of changes to other replicas for each record A, B, C begin independently? If so, is there a wait period involved for each record to detect stream of updates for a given record?

2) Do propagation of changes to other replicas for each record A, B, C only begin after some time (tn) after t3 (which signals the end of writes)?

3) Assuming that I have only W(A, s1, t1) and don't write any more events for any records, typically how long it will take to propagate record A changes to all replicas? (AWS Dynamodb claims this to be under a second; I did not find any such claim for documentDb)

解决方案

Replication in DocumentDB has no intrinsic delays built into it. Within single region configurations, you have at most a few milliseconds lag between replicas in practice. In multi-region setups, it's about the network ("speed of light") lag between regions plus some compute overhead.

The reason the docs say "some time" is because this lag is dependent on your topology, and network partitions. In cases of network partitions, eventual consistency favors availability over consistency (staleness), so a replica can fall behind.

DocumentDB's implementation of eventual consistency guarantees a very high probability of consistent reads (See http://pbs.cs.berkeley.edu/). If you want stronger guarantees, you can choose a consistency level like Session, BoundedStaleness or Strong.

这篇关于“没有任何进一步的写入"是什么?在documentDb最终一致性模型中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 03:51