資料庫筆記
CAP theorem
在理論計算機科學中,CAP定理(CAP theorem),又被稱作布魯爾定理(Brewer’s theorem),它指出對於一個分布式計算系統來說,不可能同時滿足以下三點:
- 一致性(Consistency):等同於所有節點訪問同一份最新的數據副本
- 可用性(Availability):每次請求都能獲取到非錯的響應(有回應),但是不保證獲取的數據為最新數據)
- 分區容錯性(Partition tolerance):以實際效果而言,分區相當於對通信的時限要求。系統如果不能在時限內達成數據一致性,就意味著發生了分區的情況,必須就當前操作在C和A之間做出選擇。
NoSQL (Not only SQL)
- 大方向來說, NoSQL 捨去一些資料間的一致性,以換取更高的讀寫效能
BASE System
A BASE system gives up on consistency. (放棄了一致性)
「可用性」至上
- Basically available (基本可用性) indicates that the system does guarantee availability, in terms of the CAP theorem.
- Soft state (狀態隨時改變) indicates that the state of the system may change over time, even without input. This is because of the eventual consistency model.
- Eventual consistency (最終一致性) indicates that the system will become consistent over time, given that the system doesn’t receive input during that time. (系統隨著時間一致)