Spanner, TrueTime and the CAP Theorem

内容:

基本概念

  • C: Consistency,serializability

  • A: 100% availability for both read and updates

  • P: tolerance to network partiton

    对于跨区分布式系统,分区一般是不可避免的。因此如果假设分区不可避免,这样的分布式系统只能是
    CP(减少可用性)或者AP(减少一致性)。这里说的就是传统CAP理论的情况。这里有两个条件:

    1. 只在实际分区的情况下减少C 或者 A,这时也有其他损失
    2. 这里说的是100%可用性。

Spanner

对于google Spanner系统,宣称高一致性和高可用性,为CA系统。
但是严格技术上说,它不是CA系统。但如果从用户角度和实际效果看确实可以认为是CA系统。
从技术说上,分区肯定发生,这里google spanner重视一致性甚于可用性。因此技术上应该为CP系统。

分区的影响:

  1. 用户认为spanner高可用,不需写代码处理停运问题。
  2. 有其他原因导致停运。用户看到spanner down的几率很低
  3. 停运是否是因为分区导致的。在spanner,如果出现停运,实际上并不是因为分区导致的,而是其他多个错误导致的。
    所以spanner在事实上是个CA系统。

总结来说:一个系统事实上是CA系统,应该具备两个条件

  1. 至少应该有非常高的可用性,用户可以忽略异常
  2. 由于分区导致的停运很少。

reference:

https://cloudplatform.googleblog.com/2017/02/inside-Cloud-Spanner-and-the-CAP-Theorem.html
https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/45855.pdf
https://courses.engr.illinois.edu/cs525/sp2013/CAP Theorem_Combined_CS525.pdf

toread:

https://www.computer.org/cms/Computer.org/ComputingNow/homepage/2012/0512/T_CO2_CAP12YearsLater.pdf
https://www.infoq.com/articles/cap-twelve-years-later-how-the-rules-have-changed
https://www.cockroachlabs.com/blog/limits-of-the-cap-theorem/
http://simongui.github.io/2016/11/22/cap-tradeoffs.html
http://blog.cloudera.com/blog/2010/04/cap-confusion-problems-with-partition-tolerance/
https://www.infoq.com/articles/cap-twelve-years-later-how-the-rules-have-changed