NoSQL 之 CAP 定理 與 挑選

想要挑選 NoSQL 的資料庫, 首先 CAP定理 一定得先知道, 然後看看各套目前是屬於哪類的, 再來挑選適合的來使用.

補充: 對照一般 SQL 遵循的是 ACID

ACID 是指資料庫管理系統(DBMS) 在寫入/異動資料的過程中,為保證交易(transaction) 是正確可靠的,所必須具備的四個特性:

  • Atomicity: 原子性 或稱 不可分割性
  • Consistency: 一致性
  • Isolation: 隔離性 又稱獨立性
  • Durability: 持久性

CAP 定理 與 NoSQL 套件對照表

CAP 定理 可參考下述文件:

CAP theorem (CAP定理), 下述摘錄自此兩篇:

在 理論計算機科學中, CAP定理(CAP theorem), 又被稱作 布魯爾定理(Brewer's theorem), 它指出對於一個 分布式計算系統 來說,不可能同時滿足以下三點:

  • Consistency: 一致性 (所有節點在同一時間具有相同的數據) (all nodes see the same data at the same time)
  • Availability: 可用性 (保證每個請求不管成功或者失敗都有響應) (a guarantee that every request receives a response about whether it was successful or failed)
  • Partition tolerance: 分隔容忍 (系統中任意信息的丟失或失敗不會影響系統的繼續運作) (the system continues to operate despite arbitrary message loss or failure of part of the system)

根據定理,分佈式系統只能滿足三項中的兩項而不可能滿足全部三項。

因為 CAP 三者無法同時達成, 所以 NoSQL 套件目前都是符合其中兩項, 另外一項支援度就會差一點, 下述文章有整理目前 NoSQL 的資料庫, 對應 CAP 定理 的整理.

下述摘錄自此篇: NoSQL學習筆記(二)之CAP理論 (繁體中文版: NoSQL學習筆記(二)之CAP理論)

滿足一致性,可用性的系統,通常在可擴展性上不太強大:

  • Traditional RDBMSs like Postgres,MySQL, etc (relational)
  • Vertica (column-oriented)
  • Aster Data (relational)
  • Greenplum (relational)

滿足一致性,分區容忍性的系統,通常性能不是特別高:

  • BigTable (column-oriented/tabular)
  • Hypertable (column-oriented/tabular)
  • HBase (column-oriented/tabular)
  • MongoDB (document-oriented)
  • Terrastore (document-oriented)
  • Redis (key-value)
  • Scalaris (key-value)
  • MemcacheDB (key-value)
  • Berkeley DB (key-value)

滿足可用性,分區容忍性的系統,通常可能對一致性要求低一些:

  • Dynamo (key-value)
  • Voldemort (key-value)
  • Tokyo Cabinet (key-value)
  • KAI (key-value)
  • Cassandra (column-oriented/tabular)
  • CouchDB (document-oriented)
  • SimpleDB (document-oriented)
  • Riak (document-oriented)

相關網頁

作者: Tsung

對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.

在〈NoSQL 之 CAP 定理 與 挑選〉中有 3 則留言

  1. Amazon SimpleDB can be useful for those who need a non-relational database for storage of smaller, non-structural data. Amazon SimpleDB has restricted storage size to 10GB per domain. Amazon SimpleDB offers simplicity and flexibility. SimpleDB automatically indexes all data. Amazon SimpleDB pricing is based on your actual box usage. You can store any UTF-8 string data in Amazon SimpleDB.

    SDB Explorer provides an industry-leading and intuitive Graphical User Interface (GUI) to explore Amazon SimpleDB service in a thorough manner, and in a very efficient and user friendly way.

SDBExplorer - Tool for Amazon SimpleDB 發表迴響取消回覆

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料