
CAP …
Consistency

每個讀取都可以讀到最新的值。
Every read received the latest written value.
Availability
只要有客戶發出請求,伺服器一定要回應。但回應值不一定是最新值。
If there are requests from client, servers must reply. But no guarantee that it returns the latest written value.
Partition Tolerance

分布式中,可能有訊息無法同步或者接收不到,導致發生部分區域不一致的現象。
In distributed systems, some message losing or servers unavailable leads inconsistency between nodes.
AP or CP …
1.Why not AC ?
如果系統可以保持同步且一定可以回應客戶,那就不會出現部分區域不一致的問題。既然會發生不一致的問題,表示 AC 無法同時達成。
If system can achieve availability and consistency, it won’t happen partition tolerance. We are positive that partition tolerance happen ed which means we can’t achieve both availability and consistency.
2. What happened when partition occurs?
a. Consistency over availability
保證節點間的一致性,我們必須犧牲節點的可用性,因為需要等待同步的時間。
We make sure consistency between nodes which means the availability will decrease since we wait for syncing.
b. Availability over consistency
當等待過久時,取消一些操作,降低等待時間,可以確保節點的可用。
When the execution time is too long, we cancel some operations to decrease the waiting time and ensure the availability of nodes.
Question …
1.What should we choose?
a. Consistency over availability
例如:銀行交易,不可以發生不一致的情況。
For example: the bank transaction. It cannot happen inconsistency.
b. Availability over consistency
例如:普通網頁頁面。可以容許暫時不一致性,僅要求最終一致性。
For example: web pages. We can tolerance temporary inconsistency and only require eventually consistency.
-MsHe