Spanner, TrueTime, and the CAP Theorem

Learn how Spanner does not violate the CAP theorem.

CAP theorem

Spanner is a global, highly available SQL database that easily handles massive amounts of data and transaction volume due to its replication capabilities. All data inserted into the database is given a timestamp that is accurate in the present, and clients can perform global consistent reads without requiring locking.

According to the CAP theorem, only two of the following three features can coexist in a given system:

  • C: Consistency

  • A: Availability

  • P: Tolerance to network partitions

Depending on which letter we omit, we get three distinct systems: CA, CP, and AP. For distributed systems, partitions are often unavoidable. Therefore, any distributed system has to give up either consistency (AP) or availability (CP), which is a tradeoff no one wants to undertake.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.