SlideShare una empresa de Scribd logo
1 de 158
Making Time with Vector Clocks
Matthew Sackman
matthew@goshawkdb.io
https://goshawkdb.io/
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
goshawkdb
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Presented at QCon London
www.qconlondon.com
1. Have you played with a NoSQL or NewSQL store?
1. Have you played with a NoSQL or NewSQL store?
2. Have you deployed a NoSQL or NewSQL store?
1. Have you played with a NoSQL or NewSQL store?
2. Have you deployed a NoSQL or NewSQL store?
3. Have you studied and know their semantics?
Traditional Database Semantics
ACID
• Atomic: an operation (transaction) either succeeds or aborts
completely - no partial successes
• Consistent: constraints like uniqueness, foreign keys, etc are
honoured
• Durable: flushed to disk before the client can find out the result
Traditional Database Semantics
ACID
• Atomic: an operation (transaction) either succeeds or aborts
completely - no partial successes
• Consistent: constraints like uniqueness, foreign keys, etc are
honoured
• Isolation: the degree to which operations in one transaction
can observe actions of concurrent transactions
• Durable: flushed to disk before the client can find out the result
Traditional Database Semantics
Default isolation levels
• PostgreSQL:
• Oracle 11g:
• MS SQL Server:
• MySQL InnoDB:
Traditional Database Semantics
Default isolation levels
• PostgreSQL: Read Committed
• Oracle 11g: Read Committed
• MS SQL Server: Read Committed
• MySQL InnoDB:
Traditional Database Semantics
Default isolation levels
• PostgreSQL: Read Committed
• Oracle 11g: Read Committed
• MS SQL Server: Read Committed
• MySQL InnoDB: Repeatable Read
Isolation Levels
Snapshot Isolation
as per Wikipedia
“Snapshot isolation is a guarantee that all reads made in a transaction
will see a consistent snapshot of the database and the transaction
itself will successfully commit only if no updates it has made conflict
with any concurrent updates made since that snapshot.”
Snapshot Isolation
as per Wikipedia
“Snapshot isolation is a guarantee that all reads made in a transaction
will see a consistent snapshot of the database and the transaction
itself will successfully commit only if no updates it has made conflict
with any concurrent updates made since that snapshot.”
Snapshot isolation is called “serializable” mode in Oracle.
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2: x:0, y:1
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2: x:0, y:1
t2 then t1
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2: x:0, y:1
t2 then t1: x:1, y:0
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2: x:0, y:1
t2 then t1: x:1, y:0
• Snapshot Isolation:
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2: x:0, y:1
t2 then t1: x:1, y:0
• Snapshot Isolation:
t1 || t2
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2: x:0, y:1
t2 then t1: x:1, y:0
• Snapshot Isolation:
t1 || t2
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2: x:0, y:1
t2 then t1: x:1, y:0
• Snapshot Isolation:
t1 || t2
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2: x:0, y:1
t2 then t1: x:1, y:0
• Snapshot Isolation:
t1 || t2: x:1, y:1
Snapshot Isolation
trouble up mill
x, y := 0,0
1 func t1() {
2 if x == 0 {
3 y = 1
4 }
5 }
func t2() {
if y == 0 {
x = 1
}
}
• Serialized:
t1 then t2: x:0, y:1
t2 then t1: x:1, y:0
• Snapshot Isolation: Write Skew
t1 || t2: x:1, y:1
Desired Features
• General purpose transactions
Desired Features
• General purpose transactions
• Strong serializability
Desired Features
• General purpose transactions
• Strong serializability
• Distribution
• Automatic sharding
• Horizontal scalability
• ...
Isolation Levels
Isolation Levels
CAP
Possibility of Partitions =) ¬(Consistency ^ Availability)
CAP
Possibility of Partitions =) ¬(Consistency ^ Availability)
CAP
Possibility of Partitions =) ¬(Consistency ^ Availability)
CAP
Possibility of Partitions =) ¬(Consistency ^ Availability)
CAP
Possibility of Partitions =) ¬(Consistency ^ Availability)
Achieving Consistency
Colours Indicate Connected Nodes
Achieving Consistency
Colours Indicate Connected Nodes
Achieving Consistency
Colours Indicate Connected Nodes
Achieving Consistency
Colours Indicate Connected Nodes
Achieving Consistency
Colours Indicate Connected Nodes
Achieving Consistency
Colours Indicate Connected Nodes
Achieving Consistency
Colours Indicate Connected Nodes
Achieving Consistency
Colours Indicate Connected Nodes
Achieving Consistency
Colours Indicate Connected Nodes
Achieving Consistency
Colours Indicate Connected Nodes
Learnings 1
• Strong serializability requires Consistency, so must sacrifice
Availability
Learnings 1
• Strong serializability requires Consistency, so must sacrifice
Availability
• To achieve Consistency, only accept operations if connected to
majority
Learnings 1
• Strong serializability requires Consistency, so must sacrifice
Availability
• To achieve Consistency, only accept operations if connected to
majority
• If cluster size is 2F + 1 then we can withstand no more than F
failures
Modifying Values
Colours Indicate Extent of Txn Write
Modifying Values
Colours Indicate Extent of Txn Write
Modifying Values
Colours Indicate Extent of Txn Write
Modifying Values
Colours Indicate Extent of Txn Write
Modifying Values
Colours Indicate Extent of Txn Write
Modifying Values
Colours Indicate Extent of Txn Write
Learnings 2
• Strong serializability requires Consistency, so must sacrifice
Availability
• To achieve Consistency, only accept operations if connected to
majority
• If cluster size is 2F + 1 then we can withstand no more than F
failures
• Writes must go to F + 1 nodes
Reading Values
Colours Indicate Extent of Txn Write
Reading Values
Colours Indicate Extent of Txn Write
Reading Values
Colours Indicate Extent of Txn Write
Reading Values
Colours Indicate Extent of Txn Write
Reading Values
Colours Indicate Extent of Txn Write
Reading Values
Colours Indicate Extent of Txn Write
Learnings 3
• Strong serializability requires Consistency, so must sacrifice
Availability
• To achieve Consistency, only accept operations if connected to
majority
• If cluster size is 2F + 1 then we can withstand no more than F
failures
• Writes must go to F + 1 nodes
• Reads must read from F + 1 nodes and be able to order results
Txn Processing in Distributed Databases
1. Client submits txn
Txn Processing in Distributed Databases
1. Client submits txn
2. Node(s) vote on txn
Txn Processing in Distributed Databases
1. Client submits txn
2. Node(s) vote on txn
3. Node(s) reach consensus on txn outcome
Txn Processing in Distributed Databases
1. Client submits txn
2. Node(s) vote on txn
3. Node(s) reach consensus on txn outcome
4. Client is informed of outcome
Txn Processing in Distributed Databases
1. Client submits txn
2. Node(s) vote on txn
3. Node(s) reach consensus on txn outcome
4. Client is informed of outcome
Most important thing is all nodes agree on the order of transactions
Txn Processing in Distributed Databases
1. Client submits txn
2. Node(s) vote on txn
3. Node(s) reach consensus on txn outcome
4. Client is informed of outcome
Most important thing is all nodes agree on the order of transactions
(focus for the rest of this talk!)
Leader Based Ordering
Leader Based Ordering
Leader Based Ordering
Leader Based Ordering
• Only leader votes on whether txn commits or aborts
Leader Based Ordering
• Only leader votes on whether txn commits or aborts
• Therefore leader must know everything
Leader Based Ordering
• Only leader votes on whether txn commits or aborts
• Therefore leader must know everything
• If leader fails, a new leader will be elected from remaining
nodes
Leader Based Ordering
• Only leader votes on whether txn commits or aborts
• Therefore leader must know everything
• If leader fails, a new leader will be elected from remaining
nodes
• Therefore all nodes must know everything
Leader Based Ordering
• Only leader votes on whether txn commits or aborts
• Therefore leader must know everything
• If leader fails, a new leader will be elected from remaining
nodes
• Therefore all nodes must know everything
• Fine for small clusters, but scaling issues when clusters get big
Client Clock Based Ordering
Client Clock Based Ordering
Client Clock Based Ordering
Client Clock Based Ordering
• Nodes receive txns and must vote on txn outcome and then
consensus must be reached (not shown)
Client Clock Based Ordering
• Nodes receive txns and must vote on txn outcome and then
consensus must be reached (not shown)
• Clients are responsible for applying an increasing clock value
to txns
Client Clock Based Ordering
• Nodes receive txns and must vote on txn outcome and then
consensus must be reached (not shown)
• Clients are responsible for applying an increasing clock value
to txns
• If a client’s clock races then it can prevent other clients from
getting txns submitted
Client Clock Based Ordering
• Nodes receive txns and must vote on txn outcome and then
consensus must be reached (not shown)
• Clients are responsible for applying an increasing clock value
to txns
• If a client’s clock races then it can prevent other clients from
getting txns submitted
• So must be very careful to try and keep clocks running at the
same rate
Client Clock Based Ordering
• Nodes receive txns and must vote on txn outcome and then
consensus must be reached (not shown)
• Clients are responsible for applying an increasing clock value
to txns
• If a client’s clock races then it can prevent other clients from
getting txns submitted
• So must be very careful to try and keep clocks running at the
same rate
• No possibility to reorder transactions at all to maximise
commits
Syntax
V1 < V2 ,8x 2 dom(V1 [ V2) : V1[x]  V2[x]
^9y 2 dom(V1 [ V2) : V1[y] < V2[y]
Simple Transaction
Simple Transaction
Simple Transaction
Simple Transaction
Simple Transaction
Simple Transaction
Simple Transaction
Simple Transaction
Two Writes
Two Writes
Two Writes
Two Writes
Two Writes
Two Writes
Three Writes
Three Writes
Three Writes
Three Writes
Three Writes
Three Writes
Three Writes
Three Writes
The Dumb Approach Doesn’t Work
• Changing state when receiving a txn seems to be a very bad
idea
The Dumb Approach Doesn’t Work
• Changing state when receiving a txn seems to be a very bad
idea
• Maybe only change state when receiving the outcome of a
vote
The Dumb Approach Doesn’t Work
• Changing state when receiving a txn seems to be a very bad
idea
• Maybe only change state when receiving the outcome of a
vote
• And don’t vote on txns until we know it’s safe to do so
New Ideas
• Divide time into frames. First half of frame is reads, second half
writes.
New Ideas
• Divide time into frames. First half of frame is reads, second half
writes.
• Within a frame, we don’t care about order of reads,
• but all reads must come after writes of previous frame,
• all writes must come after reads of this frame,
• all writes must be totally ordered within the frame - must know
which write comes last.
Frames & Dependencies
Frames & Dependencies
Frames & Dependencies
Frames & Dependencies
Frames & Dependencies
Frames & Dependencies
Frames & Dependencies
Frames & Dependencies
Calculating the Write Clock from Reads
• Merge all read clocks together
• Add 1 to result for every object that was written by txns in our
frame’s reads
Calculating the Frame Winner
& Next Frame’s Read Clock
• Partition write results by local clock elem, and within that by
txn id
• Each clock inherits missing clock elems from above
• Then sort each partition first by clock (now all same length),
then by txn id
• Next frame starts with winner’s clock, +1 for all writes
Calculating the Frame Winner
& Next Frame’s Read Clock
• Partition write results by local clock elem, and within that by
txn id
• Each clock inherits missing clock elems from above
• Then sort each partition first by clock (now all same length),
then by txn id
• Next frame starts with winner’s clock, +1 for all writes
• Guarantees no concurrent vector clocks (proof in progress!)
Calculating the Frame Winner
& Next Frame’s Read Clock
• Partition write results by local clock elem, and within that by
txn id
• Each clock inherits missing clock elems from above
• Then sort each partition first by clock (now all same length),
then by txn id
• Next frame starts with winner’s clock, +1 for all writes
• Guarantees no concurrent vector clocks (proof in progress!)
• Many details elided! (deadlock freedom, etc)
Transitive Vector Clocks
Transitive Vector Clocks
Transitive Vector Clocks
Transitive Vector Clocks
Transitive Vector Clocks
Transitive Vector Clocks
Transitive Vector Clocks
Transitive Vector Clocks
Transitive Vector Clocks
Transitive Vector Clocks
Shrinking Vector Clocks
• Hardest part of Paxos is garbage collection
Shrinking Vector Clocks
• Hardest part of Paxos is garbage collection
• Need additional messages to determine when Paxos instances
can be deleted
Shrinking Vector Clocks
• Hardest part of Paxos is garbage collection
• Need additional messages to determine when Paxos instances
can be deleted
• We can use these to also express:
You will never see any of these vector clock elems again
Shrinking Vector Clocks
• Hardest part of Paxos is garbage collection
• Need additional messages to determine when Paxos instances
can be deleted
• We can use these to also express:
You will never see any of these vector clock elems again
• Therefore we can remove matching elems from vector clocks!
• Many more details elided!
Conclusions
Vector clocks capture dependencies and causal relationship
between transactions
Conclusions
Vector clocks capture dependencies and causal relationship
between transactions
Plus we always add transactions into the youngest frame
Conclusions
Vector clocks capture dependencies and causal relationship
between transactions
Plus we always add transactions into the youngest frame
Which gets us Strong Serializability
Conclusions
No leader, so no potential bottleneck
Conclusions
No leader, so no potential bottleneck
No wall clocks, so no issues with clock skews
Conclusions
No leader, so no potential bottleneck
No wall clocks, so no issues with clock skews
Can separate F from cluster size,
Conclusions
No leader, so no potential bottleneck
No wall clocks, so no issues with clock skews
Can separate F from cluster size,
Which gets us horizontal scalability
Conclusions
References (1)
• Interval Tree Clocks - Paulo Sérgio Almeida, Carlos Baquero,
Victor Fonte
• Highly available transactions: Virtues and limitations - Bailis et
al
• Coordination avoidance in database systems - Bailis et al
• k-dependency vectors: A scalable causality-tracking protocol -
Baldoni, Melideo
• Multiversion concurrency control-theory and algorithms -
Bernstein, Goodman
• Serializable isolation for snapshot databases - Cahill, Röhm,
Fekete
• Paxos made live: an engineering perspective - Chandra,
Griesemer, Redstone
References (2)
• Consensus on transaction commit - Gray, Lamport
• Spanner: Google’s globally distributed database - Corbett et al
• Faster generation of shorthand universal cycles for
permutations - Holroyd, Ruskey, Williams
• s-Overlap Cycles for Permutations - Horan, Hurlbert
• Universal cycles of k-subsets and k-permutations - Jackson
• Zab: High-performance broadcast for primary-backup systems
- Junqueira, Reed, Serafini
• Time, clocks, and the ordering of events in a distributed system
- Lamport
References (3)
• The part-time parliament - Lamport
• Paxos made simple - Lamport
• Consistency, Availability, and Convergence - Mahajan, Alvisi,
Dahlin
• Notes on Theory of Distributed Systems - Aspnes
• In search of an understandable consensus algorithm - Ongaro,
Ousterhaut
• Perfect Consistent Hashing - Sackman
• The case for determinism in database systems - Thomson,
Abadi
Distributed databases are FUN!
https://goshawkdb.io/
Watch the video with slide synchronization on
InfoQ.com!
https://www.infoq.com/presentations/goshawkdb

Más contenido relacionado

Similar a GoshawkDB: Making Time with Vector Clocks

Deep Turnover Forecast - meetup Lille
Deep Turnover Forecast - meetup LilleDeep Turnover Forecast - meetup Lille
Deep Turnover Forecast - meetup LilleCarta Alfonso
 
1D Convolutional Neural Networks for Time Series Modeling - Nathan Janos, Jef...
1D Convolutional Neural Networks for Time Series Modeling - Nathan Janos, Jef...1D Convolutional Neural Networks for Time Series Modeling - Nathan Janos, Jef...
1D Convolutional Neural Networks for Time Series Modeling - Nathan Janos, Jef...PyData
 
Machine Learning Essentials Demystified part2 | Big Data Demystified
Machine Learning Essentials Demystified part2 | Big Data DemystifiedMachine Learning Essentials Demystified part2 | Big Data Demystified
Machine Learning Essentials Demystified part2 | Big Data DemystifiedOmid Vahdaty
 
NVIDIA 深度學習教育機構 (DLI): Image segmentation with tensorflow
NVIDIA 深度學習教育機構 (DLI): Image segmentation with tensorflowNVIDIA 深度學習教育機構 (DLI): Image segmentation with tensorflow
NVIDIA 深度學習教育機構 (DLI): Image segmentation with tensorflowNVIDIA Taiwan
 
Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford MapR Technologies
 
running stable diffusion on android
running stable diffusion on androidrunning stable diffusion on android
running stable diffusion on androidKoan-Sin Tan
 
[DSC 2016] 系列活動:李宏毅 / 一天搞懂深度學習
[DSC 2016] 系列活動:李宏毅 / 一天搞懂深度學習[DSC 2016] 系列活動:李宏毅 / 一天搞懂深度學習
[DSC 2016] 系列活動:李宏毅 / 一天搞懂深度學習台灣資料科學年會
 
Document Analysis with Deep Learning
Document Analysis with Deep LearningDocument Analysis with Deep Learning
Document Analysis with Deep Learningaiaioo
 
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsGo Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsJonas Bonér
 
Ralf Herbrich - Introduction to Graphical models in Industry
Ralf Herbrich - Introduction to Graphical models in IndustryRalf Herbrich - Introduction to Graphical models in Industry
Ralf Herbrich - Introduction to Graphical models in IndustryBayes Nets meetup London
 
Machine Learning from a Software Engineer's perspective
Machine Learning from a Software Engineer's perspectiveMachine Learning from a Software Engineer's perspective
Machine Learning from a Software Engineer's perspectiveMarijn van Zelst
 
Machine learning from a software engineer's perspective - Marijn van Zelst - ...
Machine learning from a software engineer's perspective - Marijn van Zelst - ...Machine learning from a software engineer's perspective - Marijn van Zelst - ...
Machine learning from a software engineer's perspective - Marijn van Zelst - ...Codemotion
 
Practical Deep Learning Using Tensor Flow - Sandeep Kath
Practical Deep Learning Using Tensor Flow - Sandeep KathPractical Deep Learning Using Tensor Flow - Sandeep Kath
Practical Deep Learning Using Tensor Flow - Sandeep KathSandeep Kath
 
Deep Learning Introduction - WeCloudData
Deep Learning Introduction - WeCloudDataDeep Learning Introduction - WeCloudData
Deep Learning Introduction - WeCloudDataWeCloudData
 
Deep Learning for Personalized Search and Recommender Systems
Deep Learning for Personalized Search and Recommender SystemsDeep Learning for Personalized Search and Recommender Systems
Deep Learning for Personalized Search and Recommender SystemsBenjamin Le
 
Cassandra introduction mars jug
Cassandra introduction mars jugCassandra introduction mars jug
Cassandra introduction mars jugDuyhai Doan
 
Instrumentation & the Pitfalls of Abstraction
Instrumentation & the Pitfalls of AbstractionInstrumentation & the Pitfalls of Abstraction
Instrumentation & the Pitfalls of AbstractionESUG
 
5707_10_auto-encoder.pptx
5707_10_auto-encoder.pptx5707_10_auto-encoder.pptx
5707_10_auto-encoder.pptxSidoriOne
 

Similar a GoshawkDB: Making Time with Vector Clocks (20)

Deep Turnover Forecast - meetup Lille
Deep Turnover Forecast - meetup LilleDeep Turnover Forecast - meetup Lille
Deep Turnover Forecast - meetup Lille
 
1D Convolutional Neural Networks for Time Series Modeling - Nathan Janos, Jef...
1D Convolutional Neural Networks for Time Series Modeling - Nathan Janos, Jef...1D Convolutional Neural Networks for Time Series Modeling - Nathan Janos, Jef...
1D Convolutional Neural Networks for Time Series Modeling - Nathan Janos, Jef...
 
Machine Learning Essentials Demystified part2 | Big Data Demystified
Machine Learning Essentials Demystified part2 | Big Data DemystifiedMachine Learning Essentials Demystified part2 | Big Data Demystified
Machine Learning Essentials Demystified part2 | Big Data Demystified
 
NVIDIA 深度學習教育機構 (DLI): Image segmentation with tensorflow
NVIDIA 深度學習教育機構 (DLI): Image segmentation with tensorflowNVIDIA 深度學習教育機構 (DLI): Image segmentation with tensorflow
NVIDIA 深度學習教育機構 (DLI): Image segmentation with tensorflow
 
Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford
 
running stable diffusion on android
running stable diffusion on androidrunning stable diffusion on android
running stable diffusion on android
 
[DSC 2016] 系列活動:李宏毅 / 一天搞懂深度學習
[DSC 2016] 系列活動:李宏毅 / 一天搞懂深度學習[DSC 2016] 系列活動:李宏毅 / 一天搞懂深度學習
[DSC 2016] 系列活動:李宏毅 / 一天搞懂深度學習
 
Document Analysis with Deep Learning
Document Analysis with Deep LearningDocument Analysis with Deep Learning
Document Analysis with Deep Learning
 
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsGo Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
 
Ralf Herbrich - Introduction to Graphical models in Industry
Ralf Herbrich - Introduction to Graphical models in IndustryRalf Herbrich - Introduction to Graphical models in Industry
Ralf Herbrich - Introduction to Graphical models in Industry
 
Flowcharting week 5 2019 2020
Flowcharting week 5  2019  2020Flowcharting week 5  2019  2020
Flowcharting week 5 2019 2020
 
Machine Learning from a Software Engineer's perspective
Machine Learning from a Software Engineer's perspectiveMachine Learning from a Software Engineer's perspective
Machine Learning from a Software Engineer's perspective
 
Machine learning from a software engineer's perspective - Marijn van Zelst - ...
Machine learning from a software engineer's perspective - Marijn van Zelst - ...Machine learning from a software engineer's perspective - Marijn van Zelst - ...
Machine learning from a software engineer's perspective - Marijn van Zelst - ...
 
Practical Deep Learning Using Tensor Flow - Sandeep Kath
Practical Deep Learning Using Tensor Flow - Sandeep KathPractical Deep Learning Using Tensor Flow - Sandeep Kath
Practical Deep Learning Using Tensor Flow - Sandeep Kath
 
Deep Learning Introduction - WeCloudData
Deep Learning Introduction - WeCloudDataDeep Learning Introduction - WeCloudData
Deep Learning Introduction - WeCloudData
 
Concur15slides
Concur15slidesConcur15slides
Concur15slides
 
Deep Learning for Personalized Search and Recommender Systems
Deep Learning for Personalized Search and Recommender SystemsDeep Learning for Personalized Search and Recommender Systems
Deep Learning for Personalized Search and Recommender Systems
 
Cassandra introduction mars jug
Cassandra introduction mars jugCassandra introduction mars jug
Cassandra introduction mars jug
 
Instrumentation & the Pitfalls of Abstraction
Instrumentation & the Pitfalls of AbstractionInstrumentation & the Pitfalls of Abstraction
Instrumentation & the Pitfalls of Abstraction
 
5707_10_auto-encoder.pptx
5707_10_auto-encoder.pptx5707_10_auto-encoder.pptx
5707_10_auto-encoder.pptx
 

Más de C4Media

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoC4Media
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileC4Media
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020C4Media
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsC4Media
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No KeeperC4Media
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like OwnersC4Media
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaC4Media
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideC4Media
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDC4Media
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine LearningC4Media
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at SpeedC4Media
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsC4Media
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsC4Media
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleC4Media
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeC4Media
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereC4Media
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing ForC4Media
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data EngineeringC4Media
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 

Más de C4Media (20)

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No Keeper
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like Owners
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate Guide
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 

Último

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Último (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

GoshawkDB: Making Time with Vector Clocks

  • 1. Making Time with Vector Clocks Matthew Sackman matthew@goshawkdb.io https://goshawkdb.io/
  • 2. InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/ goshawkdb
  • 3. Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide Presented at QCon London www.qconlondon.com
  • 4. 1. Have you played with a NoSQL or NewSQL store?
  • 5. 1. Have you played with a NoSQL or NewSQL store? 2. Have you deployed a NoSQL or NewSQL store?
  • 6. 1. Have you played with a NoSQL or NewSQL store? 2. Have you deployed a NoSQL or NewSQL store? 3. Have you studied and know their semantics?
  • 7.
  • 8.
  • 9. Traditional Database Semantics ACID • Atomic: an operation (transaction) either succeeds or aborts completely - no partial successes • Consistent: constraints like uniqueness, foreign keys, etc are honoured • Durable: flushed to disk before the client can find out the result
  • 10. Traditional Database Semantics ACID • Atomic: an operation (transaction) either succeeds or aborts completely - no partial successes • Consistent: constraints like uniqueness, foreign keys, etc are honoured • Isolation: the degree to which operations in one transaction can observe actions of concurrent transactions • Durable: flushed to disk before the client can find out the result
  • 11. Traditional Database Semantics Default isolation levels • PostgreSQL: • Oracle 11g: • MS SQL Server: • MySQL InnoDB:
  • 12. Traditional Database Semantics Default isolation levels • PostgreSQL: Read Committed • Oracle 11g: Read Committed • MS SQL Server: Read Committed • MySQL InnoDB:
  • 13. Traditional Database Semantics Default isolation levels • PostgreSQL: Read Committed • Oracle 11g: Read Committed • MS SQL Server: Read Committed • MySQL InnoDB: Repeatable Read
  • 15. Snapshot Isolation as per Wikipedia “Snapshot isolation is a guarantee that all reads made in a transaction will see a consistent snapshot of the database and the transaction itself will successfully commit only if no updates it has made conflict with any concurrent updates made since that snapshot.”
  • 16. Snapshot Isolation as per Wikipedia “Snapshot isolation is a guarantee that all reads made in a transaction will see a consistent snapshot of the database and the transaction itself will successfully commit only if no updates it has made conflict with any concurrent updates made since that snapshot.” Snapshot isolation is called “serializable” mode in Oracle.
  • 17. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } }
  • 18. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2
  • 19. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2
  • 20. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2
  • 21. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2
  • 22. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2: x:0, y:1
  • 23. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2: x:0, y:1 t2 then t1
  • 24. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2: x:0, y:1 t2 then t1: x:1, y:0
  • 25. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2: x:0, y:1 t2 then t1: x:1, y:0 • Snapshot Isolation:
  • 26. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2: x:0, y:1 t2 then t1: x:1, y:0 • Snapshot Isolation: t1 || t2
  • 27. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2: x:0, y:1 t2 then t1: x:1, y:0 • Snapshot Isolation: t1 || t2
  • 28. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2: x:0, y:1 t2 then t1: x:1, y:0 • Snapshot Isolation: t1 || t2
  • 29. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2: x:0, y:1 t2 then t1: x:1, y:0 • Snapshot Isolation: t1 || t2: x:1, y:1
  • 30. Snapshot Isolation trouble up mill x, y := 0,0 1 func t1() { 2 if x == 0 { 3 y = 1 4 } 5 } func t2() { if y == 0 { x = 1 } } • Serialized: t1 then t2: x:0, y:1 t2 then t1: x:1, y:0 • Snapshot Isolation: Write Skew t1 || t2: x:1, y:1
  • 31. Desired Features • General purpose transactions
  • 32. Desired Features • General purpose transactions • Strong serializability
  • 33. Desired Features • General purpose transactions • Strong serializability • Distribution • Automatic sharding • Horizontal scalability • ...
  • 34.
  • 37. CAP Possibility of Partitions =) ¬(Consistency ^ Availability)
  • 38. CAP Possibility of Partitions =) ¬(Consistency ^ Availability)
  • 39. CAP Possibility of Partitions =) ¬(Consistency ^ Availability)
  • 40. CAP Possibility of Partitions =) ¬(Consistency ^ Availability)
  • 41. CAP Possibility of Partitions =) ¬(Consistency ^ Availability)
  • 52. Learnings 1 • Strong serializability requires Consistency, so must sacrifice Availability
  • 53. Learnings 1 • Strong serializability requires Consistency, so must sacrifice Availability • To achieve Consistency, only accept operations if connected to majority
  • 54. Learnings 1 • Strong serializability requires Consistency, so must sacrifice Availability • To achieve Consistency, only accept operations if connected to majority • If cluster size is 2F + 1 then we can withstand no more than F failures
  • 55. Modifying Values Colours Indicate Extent of Txn Write
  • 56. Modifying Values Colours Indicate Extent of Txn Write
  • 57. Modifying Values Colours Indicate Extent of Txn Write
  • 58. Modifying Values Colours Indicate Extent of Txn Write
  • 59. Modifying Values Colours Indicate Extent of Txn Write
  • 60. Modifying Values Colours Indicate Extent of Txn Write
  • 61. Learnings 2 • Strong serializability requires Consistency, so must sacrifice Availability • To achieve Consistency, only accept operations if connected to majority • If cluster size is 2F + 1 then we can withstand no more than F failures • Writes must go to F + 1 nodes
  • 62. Reading Values Colours Indicate Extent of Txn Write
  • 63. Reading Values Colours Indicate Extent of Txn Write
  • 64. Reading Values Colours Indicate Extent of Txn Write
  • 65. Reading Values Colours Indicate Extent of Txn Write
  • 66. Reading Values Colours Indicate Extent of Txn Write
  • 67. Reading Values Colours Indicate Extent of Txn Write
  • 68. Learnings 3 • Strong serializability requires Consistency, so must sacrifice Availability • To achieve Consistency, only accept operations if connected to majority • If cluster size is 2F + 1 then we can withstand no more than F failures • Writes must go to F + 1 nodes • Reads must read from F + 1 nodes and be able to order results
  • 69.
  • 70. Txn Processing in Distributed Databases 1. Client submits txn
  • 71. Txn Processing in Distributed Databases 1. Client submits txn 2. Node(s) vote on txn
  • 72. Txn Processing in Distributed Databases 1. Client submits txn 2. Node(s) vote on txn 3. Node(s) reach consensus on txn outcome
  • 73. Txn Processing in Distributed Databases 1. Client submits txn 2. Node(s) vote on txn 3. Node(s) reach consensus on txn outcome 4. Client is informed of outcome
  • 74. Txn Processing in Distributed Databases 1. Client submits txn 2. Node(s) vote on txn 3. Node(s) reach consensus on txn outcome 4. Client is informed of outcome Most important thing is all nodes agree on the order of transactions
  • 75. Txn Processing in Distributed Databases 1. Client submits txn 2. Node(s) vote on txn 3. Node(s) reach consensus on txn outcome 4. Client is informed of outcome Most important thing is all nodes agree on the order of transactions (focus for the rest of this talk!)
  • 79. Leader Based Ordering • Only leader votes on whether txn commits or aborts
  • 80. Leader Based Ordering • Only leader votes on whether txn commits or aborts • Therefore leader must know everything
  • 81. Leader Based Ordering • Only leader votes on whether txn commits or aborts • Therefore leader must know everything • If leader fails, a new leader will be elected from remaining nodes
  • 82. Leader Based Ordering • Only leader votes on whether txn commits or aborts • Therefore leader must know everything • If leader fails, a new leader will be elected from remaining nodes • Therefore all nodes must know everything
  • 83. Leader Based Ordering • Only leader votes on whether txn commits or aborts • Therefore leader must know everything • If leader fails, a new leader will be elected from remaining nodes • Therefore all nodes must know everything • Fine for small clusters, but scaling issues when clusters get big
  • 84. Client Clock Based Ordering
  • 85. Client Clock Based Ordering
  • 86. Client Clock Based Ordering
  • 87. Client Clock Based Ordering • Nodes receive txns and must vote on txn outcome and then consensus must be reached (not shown)
  • 88. Client Clock Based Ordering • Nodes receive txns and must vote on txn outcome and then consensus must be reached (not shown) • Clients are responsible for applying an increasing clock value to txns
  • 89. Client Clock Based Ordering • Nodes receive txns and must vote on txn outcome and then consensus must be reached (not shown) • Clients are responsible for applying an increasing clock value to txns • If a client’s clock races then it can prevent other clients from getting txns submitted
  • 90. Client Clock Based Ordering • Nodes receive txns and must vote on txn outcome and then consensus must be reached (not shown) • Clients are responsible for applying an increasing clock value to txns • If a client’s clock races then it can prevent other clients from getting txns submitted • So must be very careful to try and keep clocks running at the same rate
  • 91. Client Clock Based Ordering • Nodes receive txns and must vote on txn outcome and then consensus must be reached (not shown) • Clients are responsible for applying an increasing clock value to txns • If a client’s clock races then it can prevent other clients from getting txns submitted • So must be very careful to try and keep clocks running at the same rate • No possibility to reorder transactions at all to maximise commits
  • 92. Syntax V1 < V2 ,8x 2 dom(V1 [ V2) : V1[x]  V2[x] ^9y 2 dom(V1 [ V2) : V1[y] < V2[y]
  • 115. The Dumb Approach Doesn’t Work • Changing state when receiving a txn seems to be a very bad idea
  • 116. The Dumb Approach Doesn’t Work • Changing state when receiving a txn seems to be a very bad idea • Maybe only change state when receiving the outcome of a vote
  • 117. The Dumb Approach Doesn’t Work • Changing state when receiving a txn seems to be a very bad idea • Maybe only change state when receiving the outcome of a vote • And don’t vote on txns until we know it’s safe to do so
  • 118. New Ideas • Divide time into frames. First half of frame is reads, second half writes.
  • 119. New Ideas • Divide time into frames. First half of frame is reads, second half writes. • Within a frame, we don’t care about order of reads, • but all reads must come after writes of previous frame, • all writes must come after reads of this frame, • all writes must be totally ordered within the frame - must know which write comes last.
  • 128. Calculating the Write Clock from Reads • Merge all read clocks together • Add 1 to result for every object that was written by txns in our frame’s reads
  • 129. Calculating the Frame Winner & Next Frame’s Read Clock • Partition write results by local clock elem, and within that by txn id • Each clock inherits missing clock elems from above • Then sort each partition first by clock (now all same length), then by txn id • Next frame starts with winner’s clock, +1 for all writes
  • 130. Calculating the Frame Winner & Next Frame’s Read Clock • Partition write results by local clock elem, and within that by txn id • Each clock inherits missing clock elems from above • Then sort each partition first by clock (now all same length), then by txn id • Next frame starts with winner’s clock, +1 for all writes • Guarantees no concurrent vector clocks (proof in progress!)
  • 131. Calculating the Frame Winner & Next Frame’s Read Clock • Partition write results by local clock elem, and within that by txn id • Each clock inherits missing clock elems from above • Then sort each partition first by clock (now all same length), then by txn id • Next frame starts with winner’s clock, +1 for all writes • Guarantees no concurrent vector clocks (proof in progress!) • Many details elided! (deadlock freedom, etc)
  • 142. Shrinking Vector Clocks • Hardest part of Paxos is garbage collection
  • 143. Shrinking Vector Clocks • Hardest part of Paxos is garbage collection • Need additional messages to determine when Paxos instances can be deleted
  • 144. Shrinking Vector Clocks • Hardest part of Paxos is garbage collection • Need additional messages to determine when Paxos instances can be deleted • We can use these to also express: You will never see any of these vector clock elems again
  • 145. Shrinking Vector Clocks • Hardest part of Paxos is garbage collection • Need additional messages to determine when Paxos instances can be deleted • We can use these to also express: You will never see any of these vector clock elems again • Therefore we can remove matching elems from vector clocks! • Many more details elided!
  • 146. Conclusions Vector clocks capture dependencies and causal relationship between transactions
  • 147. Conclusions Vector clocks capture dependencies and causal relationship between transactions Plus we always add transactions into the youngest frame
  • 148. Conclusions Vector clocks capture dependencies and causal relationship between transactions Plus we always add transactions into the youngest frame Which gets us Strong Serializability
  • 149. Conclusions No leader, so no potential bottleneck
  • 150. Conclusions No leader, so no potential bottleneck No wall clocks, so no issues with clock skews
  • 151. Conclusions No leader, so no potential bottleneck No wall clocks, so no issues with clock skews Can separate F from cluster size,
  • 152. Conclusions No leader, so no potential bottleneck No wall clocks, so no issues with clock skews Can separate F from cluster size, Which gets us horizontal scalability
  • 154. References (1) • Interval Tree Clocks - Paulo Sérgio Almeida, Carlos Baquero, Victor Fonte • Highly available transactions: Virtues and limitations - Bailis et al • Coordination avoidance in database systems - Bailis et al • k-dependency vectors: A scalable causality-tracking protocol - Baldoni, Melideo • Multiversion concurrency control-theory and algorithms - Bernstein, Goodman • Serializable isolation for snapshot databases - Cahill, Röhm, Fekete • Paxos made live: an engineering perspective - Chandra, Griesemer, Redstone
  • 155. References (2) • Consensus on transaction commit - Gray, Lamport • Spanner: Google’s globally distributed database - Corbett et al • Faster generation of shorthand universal cycles for permutations - Holroyd, Ruskey, Williams • s-Overlap Cycles for Permutations - Horan, Hurlbert • Universal cycles of k-subsets and k-permutations - Jackson • Zab: High-performance broadcast for primary-backup systems - Junqueira, Reed, Serafini • Time, clocks, and the ordering of events in a distributed system - Lamport
  • 156. References (3) • The part-time parliament - Lamport • Paxos made simple - Lamport • Consistency, Availability, and Convergence - Mahajan, Alvisi, Dahlin • Notes on Theory of Distributed Systems - Aspnes • In search of an understandable consensus algorithm - Ongaro, Ousterhaut • Perfect Consistent Hashing - Sackman • The case for determinism in database systems - Thomson, Abadi
  • 157. Distributed databases are FUN! https://goshawkdb.io/
  • 158. Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/goshawkdb