Oct 3, 2017 - reduced latency: geo-distributed replicas give us low-latency links ..... A. 1al add x,y// 1a, x, yl. 1a,
Efficient Synchronization of State-based CRDTs
Vitor Enes Carlos Baquero Jo˜ ao Leit˜ ao Tuesday 3rd October, 2017
(Universidade do Minho) (Universidade Nova de Lisboa)
Outline
1. Data Replication
2. Conflict-free Replicated Data Types - State-based CRDTs - Efficient Synchronization - Results
1
Data Replication
Data Replication
• Improves availability • available even when some replicas are unreachable
• Improves performance • reduced latency : geo-distributed replicas give us low-latency links • increased throughput: multiple replicas serving data
2
Data Replication
• Improves availability • available even when some replicas are unreachable
• Improves performance • reduced latency : geo-distributed replicas give us low-latency links • increased throughput: multiple replicas serving data
• Several consistency models, e.g.: • Strong Consistency: • illusion of a single-copy by synchronizing replicas on each update • very successful within the data center but • wide-area networks increase latency of requests and decrease system’s throughput
• Eventual Consistency: • synchronize replicas in the background • replicas may diverge
2
Conflict-free Replicated Data Types
3
Operation-based A
B
{}
{}
add
x
/ {x} add x {x}
4
Operation-based A
B
{}
{}
add
x
/ {x}
add
y
add x {x}
/ {x, y } add
y
{x, y }
4
Operation-based A
B
{}
{}
add
x
/ {x}
add
y
add x {x}
/ {x, y }
{x, y , z} ; add
y
{x, y }
add add
z
z
/ {x, y , z}
4
Operation-based A
B
{}
add
x
/ {x}
add
y
add x {x}
{}
/ {x, y }
{x, y , z} ; add
y
{x, y }
add add
z
z
/ {x, y , z}
State-based A
{}
add
x
/ {x} {x}
B
{}
{x}
4
Operation-based A
B
{}
add
x
/ {x}
add
y
/ {x, y } add
add x {x}
{}
{x, y , z} ; y
{x, y }
add add
z
z
/ {x, y , z}
State-based A
B
{}
{}
add
x
/ {x}
add
y
/ {x, y }
{x}
{x,y }
{x}
{x, y }
4
Operation-based A
B
{}
add
x
/ {x}
add
y
/ {x, y } add
add x {x}
{}
{x, y , z} ; y
{x, y }
add add
z
z
/ {x, y , z}
State-based A
{}
add
x
/ {x}
add
y
{x}
B
{}
{x}
/ {x, y }
{x, y , z} ; {x,y }
{x, y }
{x,y ,z}
add
z
/ {x, y , z}
4
Operation-based A
B
{}
add
x
/ {x}
add
y
/ {x, y } add
add x {x}
{}
{x, y , z} ; y
{x, y }
add add
z
z
/ {x, y , z}
State-based A
{}
add
x
/ {x}
add
y
{x}
B
{}
{x}
/ {x, y }
{x, y , z} ; {x,y }
{x, y }
{x,y ,z}
add
z
/ {x, y , z}
$ $ full state transmission $ $
4
Efficient Synchronization of State-based CRDTs How can we avoid replica A sending the full state to replica B?
5
Efficient Synchronization of State-based CRDTs How can we avoid replica A sending the full state to replica B? Two fundamental problems 1. A knows something about the state of B: • Goal: A to compute a delta (δ) of minimum size to be sent to B
5
Efficient Synchronization of State-based CRDTs How can we avoid replica A sending the full state to replica B? Two fundamental problems 1. A knows something about the state of B: • Goal: A to compute a delta (δ) of minimum size to be sent to B • Techniques: • avoid sending acknowledged entries in δ-buffer (Classic Delta-based CRDTs) • ... • ...
5
Efficient Synchronization of State-based CRDTs How can we avoid replica A sending the full state to replica B? Two fundamental problems 1. A knows something about the state of B: • Goal: A to compute a delta (δ) of minimum size to be sent to B • Techniques: • avoid sending acknowledged entries in δ-buffer (Classic Delta-based CRDTs) • ... • ...
2. A knows nothing: • Goal: design a protocol that minimizes state transmission
5
Efficient Synchronization of State-based CRDTs How can we avoid replica A sending the full state to replica B? Two fundamental problems 1. A knows something about the state of B: • Goal: A to compute a delta (δ) of minimum size to be sent to B • Techniques: • avoid sending acknowledged entries in δ-buffer (Classic Delta-based CRDTs) • ... • ...
2. A knows nothing: • Goal: design a protocol that minimizes state transmission • Techniques: • ... • ... 5
Solving the first problem
A
{}
add a / {a}
B
{}
add b / {b}
6
Solving the first problem
A
{}
add a / {a} {a}
B
{}
add b / {b}
{a, b}
6
Solving the first problem
A
{}
add a / {a} {a}
B
add b / {} {b}
{a, b}
{a, b} ? {a,b}
6
Solving the first problem
A
{}
add a / {a} {a}
B
{}
add b / {b}
{a, b}
{a, b} ? {a,b}
add x / {a, b, x} {a,b,x}
" {a, b, x}
6
Solving the first problem
A
{}
add a / {a} {a}
B
{}
add b / {b}
{a, b}
{a, b} ?
add x / {a, b, x} {a,b,x}
" {a, b, x}
{a,b}
Avoid back-propagation of δ-groups A
{}
add a / {a} {a}
B
{}
add b / {b}
{a, b}
{a, b} ? {a,b}
add x / {a, b, x} {a, b,x}
" {a, b, x} 6
Efficient Synchronization of State-based CRDTs How can we avoid replica A sending the full state to replica B? Two fundamental problems 1. A knows something about the state of B: • Goal: A to compute a delta (δ) of minimum size to be sent to B • Techniques: • avoid sending acknowledged entries in δ-buffer (Classic Delta-based CRDTs) • avoid back-propagation of δ-groups (BP) • ...
2. A knows nothing: • Goal: design a protocol that minimizes state transmission • Techniques: • ... • ... 7
Solving the first problem
A
{}
add a / {a}
B
{}
add b / {b}
C
{}
add c / {c}
8
Solving the first problem
A
{}
add a / {a}
B
{}
add b / {b}
C
add c / {} {c}
{a}
&
{a, b} {a}
{a, c}
8
Solving the first problem
A
{}
add a / {a}
B
{}
add b / {b}
{a}
&
{a, b} {a}
C
{}
add c / {c}
{a, c}
{a, b, c} 9 {a,c}
8
Solving the first problem
A
{}
add a / {a}
B
{}
add b / {b}
C
add c / {} {c}
{a}
&
{a, b, c} 8 {a, b} {a}
{a, c}
{a, b, c} 9
{a,b,c}
{a,c}
8
Solving the first problem
A
{}
add a / {a}
B
{}
add b / {b}
C
add c / {} {c}
{a}
&
{a, b, c} 8 {a, b} {a}
{a, c}
{a, b, c} 9
{a,b,c}
{a,c}
Remove redundant state in δ-groups A
{}
add a / {a}
B
{}
add b / {b}
C
add c / {} {c}
{a}
&
{a, b, c} 8 {a, b} {a}
{a, c}
{a, b, c} 9
{a,b,c}
{a,c}
8
Efficient Synchronization of State-based CRDTs How can we avoid replica A sending the full state to replica B? Two fundamental problems 1. A knows something about the state of B: • Goal: A to compute a delta (δ) of minimum size to be sent to B • Techniques: • avoid sending acknowledged entries in δ-buffer (Classic Delta-based CRDTs) • avoid back-propagation of δ-groups (BP) • remove redundant state in δ-groups (RR)
2. A knows nothing: • Goal: design a protocol that minimizes state transmission • Techniques: • ... • ... 9
10
Solving the second problem State-driven synchronization A
{a}
B
{a}
add
add
/ {a, x, y }
x,y
z
/ {a, z}
11
Solving the second problem State-driven synchronization A
{a}
add
/ {a, x, y }
x,y
{a, x, y , z} : {a,z}
B
{a}
add
z
/ {a, z}
11
Solving the second problem State-driven synchronization A
{a}
add
/ {a, x, y }
x,y
{a, x, y , z} : {a,z}
B
{a}
add
z
/ {a, z}
{x,y }
$ {a, x, y , z}
11
Solving the second problem State-driven synchronization A
{a}
add
/ {a, x, y }
x,y
{a, x, y , z} : {a,z}
B
{a}
add
z
/ {a, z}
{x,y }
$ {a, x, y , z}
Digest-driven synchronization A
{a}
B
{a}
add
add
/ {a, x, y }
x,y
z
/ {a, z}
11
Solving the second problem State-driven synchronization A
{a}
add
/ {a, x, y }
x,y
{a, x, y , z} : {a,z}
B
{a}
add
z
/ {a, z}
{x,y }
$ {a, x, y , z}
Digest-driven synchronization A
{a}
add
/ {a, x, y }
x,y
{a, x, y } < dB
B
{a}
add
z
/ {a, z}
11
Solving the second problem State-driven synchronization A
{a}
add
/ {a, x, y }
x,y
{a, x, y , z} : {a,z}
B
{a}
add
z
/ {a, z}
{x,y }
$ {a, x, y , z}
Digest-driven synchronization A
{a}
add
/ {a, x, y }
x,y
{a, x, y } < dB
B
{a}
add
z
/ {a, z}
(dA ,{x,y })
$ {a, x, y , z}
11
Solving the second problem State-driven synchronization A
{a}
add
/ {a, x, y }
x,y
{a, x, y , z} : {a,z}
B
{a}
add
z
/ {a, z}
{x,y }
$ {a, x, y , z}
Digest-driven synchronization A
{a}
add
/ {a, x, y }
x,y
{a, x, y } < dB
B
{a}
add
z
/ {a, z}
{a, x, y , z} : (dA ,{x,y })
$ {a, x, y , z}
{z}
11
Efficient Synchronization of State-based CRDTs How can we avoid replica A sending the full state to replica B? Two fundamental problems 1. A knows something about the state of B: • Goal: A to compute a delta (δ) of minimum size to be sent to B • Techniques: • avoid sending acknowledged entries in δ-buffer (Classic Delta-based CRDTs) • avoid back-propagation of δ-groups (BP) • remove redundant state in δ-groups (RR)
2. A knows nothing: • Goal: design a protocol that minimizes state transmission • Techniques: • state-driven synchronization • digest-driven synchronization 12
13
bit.ly/msc-presentation
13
Efficient Synchronization of State-based CRDTs
Vitor Enes Carlos Baquero Jo˜ ao Leit˜ ao Tuesday 3rd October, 2017
(Universidade do Minho) (Universidade Nova de Lisboa)