Amazon SimpleDB 支援不同程度的 Consistency

Amazon CTO Werner Vogels 的 blog 上提到了 AWS SimpleDB 支援不同程度的 consistency:「Choosing Consistency」,在 James Hamilton 也對這件事情發表正面的意見:「I love eventual consistency but...」。正式的技術文件在「Amazon SimpleDB Consistency Enhancements」這邊可以查到。

Eventual consistencyCAP theorem 中的 Consistency 妥協,試著解決 scale 問題,但缺點是 stale read (可能會讀到舊資料),對要求比較嚴謹的子系統 (像是遊戲內的各種點數,身上帶的金幣之類的) 會很麻煩,而對於要求更嚴謹的系統 (像是商品搶購時的「剩餘數量」) 幾乎無法直接使用。

像是 Colin Percival 曾經解釋他得在 S3 與 SimpleDB 上做不少 workaround:「How Tarsnap uses Amazon Web Services」以確保資料正確性。

AWS SimpleDB 這次提供了新的功能,要求寫入時一定要等到 consistent 才 return,將 consistent 的權限放給上層 application 決定,開發者可以自己拿捏。

3 thoughts on “Amazon SimpleDB 支援不同程度的 Consistency”

  1. 請教一下, 如果是 "要求寫入時一定要等到 consistent 才 return", 那應該是寫入的 function 有新的參數. 可是照 Choosing Consistency 這篇文章中寫的, 反而是 read 的時候多了個 ConsistentRead 的 flag, 感覺好像對不起來?

    可是我覺得您寫得比較有道理, 應該要在寫入做控制才對啊.

  2. read/write API 都有增加。你可以看文件的下半部,除了 select 與 GetAttributes 外,PutAttributes 與 DeleteAttributes 也有改變。

    只提了寫入的部份是因為我想不到現實世界會用到的例子是 read consistency 比 write consistency 好...

Leave a Reply

Your email address will not be published. Required fields are marked *