Amazon S3是否保证写顺序? [英] Does Amazon S3 guarantee write ordering?
问题描述
Amazon S3提供了一个最终一致性"模型,最终存储在此模型中的所有客户端都可以看到您存储的数据.
Amazon S3 provides an "eventual consistency" model, where data you store is eventually visible to all clients.
我找不到有关是否保证写入顺序的任何官方信息.如果您要建立一个架构,使客户端可能在其他人存储数据后立即读取数据,那么这从根本上很重要.
I can't find any official information as to whether write ordering is guaranteed or not. This is fundamentally important if you are building an architecture where a client might want to read data right after someone else stored it.
如果保留了写入顺序,我可以通过让写入器存储一个保护程序(例如特殊键)并结束写入操作来轻松检查数据是否完整.
If write ordering is preserved, I can easily check whether the data is complete by having the writer store a guard (say, a special key) and the end of the write operation.
如果不能保证写入顺序,那么我将遇到一个严重的问题,因为无法确保可以安全地读取数据.
If no write ordering is guaranteed, then I have a serious problem, because there is no way I can be sure I can safely read the data.
我阅读了Werner Vogel关于一致性的文章( http://www.allthingsdistributed.com/2007/12/eventually_consistent.html ),他指出众所周知,没有单调写一致性的系统很难编程,但没有说明S3是否保证.
I read Werner Vogel's article on consistency (http://www.allthingsdistributed.com/2007/12/eventually_consistent.html), where he notes that systems without monotonic write consistency are notoriously hard to program, but does not say whether S3 guarantees it or not.
推荐答案
当亚马逊的目标是大规模的可扩展性时,保证写顺序是非常愚蠢的.考虑以下情况:
It would be very foolish of Amazon to guarantee write ordering when it's goal is massive scalability. Consider the following case:
- 与键K关联的值X存在于S3中.
- 客户端1(香港):将值A写入由服务器A服务的密钥K
- 客户端2(堪萨斯城):将值B写入由服务器B提供服务的密钥K中
最终的一致性保证了世界上所有地方的所有读者都将看到值A或值B或值X,并且最终,所有读者都将看到值A或B,但不会混合.
Eventual consistency guarantees that all readers, any where in the world, will either see value A or value B or value X, and eventually, all readers will see either value A or B, but not a mix.
如果客户端1和2同时发布其写入,则保证写入顺序的唯一方法是沿时间轴将写入彼此关联.但是,跨大西洋时钟不会完全同步.真正的问题是,当世界另一端的两个客户端在时间上靠近在一起发出写操作时,写顺序是什么意思.
If Client 1 and 2 issued their writes at the same time then the only way to guarantee write ordering is to associate the writes with each other along a time line. However, transatlantic clocks won't be perfectly synchronized. The real question here is what do you mean by write-ordering, when two clients at opposite ends of the world issue a write close together in time.
更新
单个客户端也是如此.假设从2个位置提供值,并且单个客户端发出2个连续的更新.如果两个写入都由相同的端点完成,则可能会保留您的订购.但是,没有什么可以阻止从第二个位置(路由,网络拆分等)获得满意的读取结果.
The same holds true for a single client. Suppose that a value is served from 2 locations, and a single client issues 2 consecutive updates. If both writes are served by the same end-point then it is likely your ordering will be preserved. However, nothing prevents a read from being satisfied from a second location (routing, network split, etc...).
这篇关于Amazon S3是否保证写顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!