2. What is Spanner ?
2
o Globally distributed multi-version database
General-purpose transactions (ACID)
SQL-like query language
Schematized semi-relational tables
o Currently running in production
Storage for Google’s F1 adv. backend data
Replaced a sharded MySQL database
3. Overview
3
o Lock-free distributed read transactions
o Global external consistency of distributed
transactions
o Used technologies: concurrency control, replication,
2PC and 2PL
o The key technology:TrueTime service
4. Overview
3
o Lock-free distributed read transactions
o Global external consistency of distributed
transactions
Same as linearizability: if a transaction T1 commits before
another transaction T2 starts,then T1’s commit timestamp is
smaller than T2’s.
o Used technologies: concurrency control, replication,
2PC and 2PL
o The key technology:TrueTime service
5. Spanner server organization
4
o A Spanner deployment is called an
universe
o It have two singletons: the universe
master and the placement driver
6. Spanner server organization
4
o A Spanner deployment is called an
universe
o It have two singletons: the universe
master and the placement driver
o Can have up to several thousands
spanservers
7. Spanner server organization
4
o A Spanner deployment is called an
universe
o It have two singletons: the universe
master and the placement driver
o Can have up to several thousands
spanservers
o Organized as a set of zones
8. Datacenter
in US
Datacenter
in Spain
Datacenter
in Sweden
Datacenter
in Russia
Serving data from multiple datacenters
5
Data from
US
Data from
Spain
Data from
Sweden
Data from
Russia
Get the complete
data set
Block
writes
9. Datacenter
in US
Datacenter
in Spain
Datacenter
in Sweden
Datacenter
in Russia
Serving data from multiple datacenters
5
Data from
US
Data from
Spain
Data from
Sweden
Data from
Russia
Get the complete
data set
10. Serving data from multiple datacenters
5
Data from
US
Data from
Spain
Data from
Sweden
Data from
Russia
Get the complete
data set
11. Serving data from multiple datacenters
5
Data from
US
Data from
Spain
Data from
Sweden
Data from
Russia
Get the complete
data set
15. time
earliest latest
2*ɛ
TT.now()
True Time API
7
o Provides an absolute time denoted
as „Global wall-clock time“.
o Has bounded uncertainty ɛ, which
varies between 1 to 7 ms over
each poll interval
o Values derived from the worst
case local-clock drift scenario
Method Returns
TT.now() TTinterval:[earliest, latest]
TT.after(t) true if t has definitely passed
TT.before(t) true if t has definitely not arrived
16. time
earliest latest
2*ɛ
TT.now()
True Time API
7
o Provides an absolute time denoted
as „Global wall-clock time“.
o Has bounded uncertainty ɛ, which
varies between 1 to 7 ms over
each poll interval
o Values derived from the worst
case local-clock drift scenario
Method Returns
TT.now() TTinterval:[earliest, latest]
TT.after(t) true if t has definitely passed
TT.before(t) true if t has definitely not arrived
17. time
earliest latest
2*ɛ
TT.now()
True Time API
7
o Provides an absolute time denoted
as „Global wall-clock time“.
o Has bounded uncertainty ɛ, which
varies between 1 to 7 ms over
each poll interval
o Values derived from the worst
case local-clock drift scenario
o Magic number:200 μs/s
Method Returns
TT.now() TTinterval:[earliest, latest]
TT.after(t) true if t has definitely passed
TT.before(t) true if t has definitely not arrived
23. Spanserver software stack
10
o Tablet implements mappings:
(key, timestamp) -> string
o The Paxos state machine for
replication support
o Writes initiate the Paxos
protocol at the leader
o Focuses on long-lived
transactions
32. Additional uncovered bits
12
Supports atomic schema changes
Non-blocking snapshot reads in the past
How to read at the present time
Paxos protocol restriction
Does not support in-Paxos configuration changes
39. Conclusion
16
The first service to provide global externally consistent
multi-version database
Relies on novel timeAPI (TrueTime)
Improvements introduced over previous services