一篇非常精彩的解释CAP理论的文章,翻译水平有限,不准确之处请参考原文,还请见谅。
Chapter 1: “Remembrance Inc” Your new venture :
Remembrance Inc! - Never forget, even without remembering!
Ever felt bad that you forget so much? Don't worry. Help is just a phone away!
So, your typical phone conversation will look like this:
· Customer : Hey, Can you store my neighbor’s birthday?
· You: No problem! We charged your credit card with $0.1
Ø 你:(在笔记本上该客户的那一页记下)记好了!想知道他生日时随时打给我们!
Chapter 2 : You scale up:
Your start with a simple plan:
1. You and your wife both get an extension phone
2. Customers still dial (555)–55-REMEM and need to remember only one number
3. A pbx will route the a customers call to whoever is free and equally
Chapter 3 : You have your first “Bad Service” :
· You: Glad you called “Remembrance Inc!”. What can I do for you?
· Jhon: Can you tell me when is my flight to New Delhi?
· You: Sir, I think there is a mistake. You never told us about your flight to delhi
· Jhon: What! I just called you guys yesterday!(cuts the call!)
Ø 你:当然可以,请稍等(你翻阅你的笔记本,在Jhon那页却没发现航班这一项)。
Chapter 4: You fix the Consistency problem:
” Darling this is what we are going to do from now”
· This way both of us note down any updates
你的竞争者可能会忽视这个问题,你却不会。你妻子入睡时你想了一整晚,终于在清晨时想出了一个美丽的方案。你叫醒她说:
Ø 不论我俩谁接到客户要求记东西的电话,打完电话前我们要告诉另一个人
Ø 当客户要求查找时,我们不用互相问,因为我俩的笔记本上都记录了所有更新。
Chapter 5: You come up with the greatest solution Ever:
“看!“你跟她说,”这就是我们既一致又可用的做法,方案与我昨天告诉你的很像“:
Ø 不论我俩谁接到客户要求记东西的电话,打完电话前我们要告诉另一个人,这样我俩都能记下任何的更新。
Ø 第二天他来工作时,在处理任何来电前先看一遍这些邮件,更新到他的本子上。
天才啊!你的妻子说。这个方案想不到任何的问题的。咱们就这样来吧!记忆公司现在既是一致的又是可用的!
Chapter 6: Your wife gets angry :
Chapter 7: Conclusion :
让我们现在看一下CAP理论。它说:当你设计分布式系统时,你只能实现一致性、可用性和分区容忍中的两者:
Ø 一致性:你的客户再次来电时总能查到他们刚来电更新的信息,不论相隔多短
Ø 可用性:不论你和你妻子谁来工作,记忆公司总能接听来电,处理客户请求
Bonus : Eventual Consistency with a run around clerk :
That’s CAP and eventual consistency for you in simple english :)