An Approach to Distributed,
Eventually Consistent
Edge Computation
Selective Hearing
Christopher Meiklejohn, Machine Zone, Inc.
Peter Van Roy, Université catholique de Louvain
W-PSDS 2015, September 28, 2015
1
Slide 2
Slide 2 text
What is
Edge Computation?
2
Slide 3
Slide 3 text
Edge Computation
• Logical extremes of the network
Applications, data, and computation
3
Slide 4
Slide 4 text
Edge Computation
• Logical extremes of the network
Applications, data, and computation
• Especially important where synchronization is hard
3
Slide 5
Slide 5 text
Edge Computation
• Logical extremes of the network
Applications, data, and computation
• Especially important where synchronization is hard
• “Internet of Things”
Low power, limited memory and connectivity
3
Slide 6
Slide 6 text
Edge Computation
• Logical extremes of the network
Applications, data, and computation
• Especially important where synchronization is hard
• “Internet of Things”
Low power, limited memory and connectivity
• Mobile Applications
Offline operation with replicated, shared state
3
Slide 7
Slide 7 text
Edge Computation
• Logical extremes of the network
Applications, data, and computation
• Especially important where synchronization is hard
• “Internet of Things”
Low power, limited memory and connectivity
• Mobile Applications
Offline operation with replicated, shared state
• How should we manage state?
3
Slide 8
Slide 8 text
Selective Hearing
• Epidemic broadcast based runtime system
Provide a runtime system that can scale to large numbers of nodes,
that is resilient to failures and provides efficient execution
4
Slide 9
Slide 9 text
Selective Hearing
• Epidemic broadcast based runtime system
Provide a runtime system that can scale to large numbers of nodes,
that is resilient to failures and provides efficient execution
• Well-matched to Lattice Processing (Lasp)
4
Slide 10
Slide 10 text
Selective Hearing
• Epidemic broadcast based runtime system
Provide a runtime system that can scale to large numbers of nodes,
that is resilient to failures and provides efficient execution
• Well-matched to Lattice Processing (Lasp)
• Epidemic broadcast mechanisms provide weak ordering but are
resilient and efficient
4
Slide 11
Slide 11 text
Selective Hearing
• Epidemic broadcast based runtime system
Provide a runtime system that can scale to large numbers of nodes,
that is resilient to failures and provides efficient execution
• Well-matched to Lattice Processing (Lasp)
• Epidemic broadcast mechanisms provide weak ordering but are
resilient and efficient
• Lasp’s programming model is tolerant to message re-ordering,
disconnections, and node failures
4
Slide 12
Slide 12 text
Selective Hearing
• Epidemic broadcast based runtime system
Provide a runtime system that can scale to large numbers of nodes,
that is resilient to failures and provides efficient execution
• Well-matched to Lattice Processing (Lasp)
• Epidemic broadcast mechanisms provide weak ordering but are
resilient and efficient
• Lasp’s programming model is tolerant to message re-ordering,
disconnections, and node failures
• “Selective Receive”
Nodes selectively receive and process messages based on interest.
4
Slide 13
Slide 13 text
Background
Lattice Processing
5
Slide 14
Slide 14 text
Lattice Processing (Lasp)
• Distributed, deterministic dataflow
Distributed, deterministic dataflow programming
model for “eventually consistent” computations
6
Slide 15
Slide 15 text
Lattice Processing (Lasp)
• Distributed, deterministic dataflow
Distributed, deterministic dataflow programming
model for “eventually consistent” computations
• Convergent data structures
Primary data abstraction is the CRDT
6
Slide 16
Slide 16 text
Lattice Processing (Lasp)
• Distributed, deterministic dataflow
Distributed, deterministic dataflow programming
model for “eventually consistent” computations
• Convergent data structures
Primary data abstraction is the CRDT
• Enables composition
Provides functional composition of CRDTs that
preserves the SEC property
6
Slide 17
Slide 17 text
7
%% Create initial set.
S1 = declare(set),
%% Add elements to initial set and update.
update(S1, {add, [1,2,3]}),
%% Create second set.
S2 = declare(set),
%% Apply map operation between S1 and S2.
map(S1, fun(X) -> X * 2 end, S2).
Slide 18
Slide 18 text
8
%% Create initial set.
S1 = declare(set),
%% Add elements to initial set and update.
update(S1, {add, [1,2,3]}),
%% Create second set.
S2 = declare(set),
%% Apply map operation between S1 and S2.
map(S1, fun(X) -> X * 2 end, S2).
Slide 19
Slide 19 text
9
%% Create initial set.
S1 = declare(set),
%% Add elements to initial set and update.
update(S1, {add, [1,2,3]}),
%% Create second set.
S2 = declare(set),
%% Apply map operation between S1 and S2.
map(S1, fun(X) -> X * 2 end, S2).
Slide 20
Slide 20 text
10
%% Create initial set.
S1 = declare(set),
%% Add elements to initial set and update.
update(S1, {add, [1,2,3]}),
%% Create second set.
S2 = declare(set),
%% Apply map operation between S1 and S2.
map(S1, fun(X) -> X * 2 end, S2).
Slide 21
Slide 21 text
11
%% Create initial set.
S1 = declare(set),
%% Add elements to initial set and update.
update(S1, {add, [1,2,3]}),
%% Create second set.
S2 = declare(set),
%% Apply map operation between S1 and S2.
map(S1, fun(X) -> X * 2 end, S2).
Slide 22
Slide 22 text
Lattice Processing (Lasp)
• Functional and set-theoretic operations
on sets
Product, intersection, union, filter, map,
fold
12
Slide 23
Slide 23 text
Lattice Processing (Lasp)
• Functional and set-theoretic operations
on sets
Product, intersection, union, filter, map,
fold
• Metadata computation
Performs transformation on the internal
metadata of CRDTs allowing creation of
“composed” CRDTs
12
Slide 24
Slide 24 text
Lasp Processes
• Replicas as monotonic streams
Each replica of a CRDT produces a monotonic
stream of states
13
Slide 25
Slide 25 text
Lasp Processes
• Replicas as monotonic streams
Each replica of a CRDT produces a monotonic
stream of states
• Monotonic processes
Read from one or more input replica streams and
produce a single output replica stream
13
Slide 26
Slide 26 text
Lasp Processes
• Replicas as monotonic streams
Each replica of a CRDT produces a monotonic
stream of states
• Monotonic processes
Read from one or more input replica streams and
produce a single output replica stream
• Inflationary reads
Read operation ensures that we only read
inflationary updates to replicas
13
Advertisement Counter
• Mobile game platform selling
advertisement space
Advertisements are paid according to a
minimum number of impressions
24
Slide 38
Slide 38 text
Advertisement Counter
• Mobile game platform selling
advertisement space
Advertisements are paid according to a
minimum number of impressions
• Clients will go offline
Clients have limited connectivity and the
system still needs to make progress while
clients are offline
24
Slide 39
Slide 39 text
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
25
Slide 40
Slide 40 text
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Riot Ads
Rovio
Ads
Product
Read
50,000
Remove
Increment
Union
26
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
Slide 41
Slide 41 text
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Rovio Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
1
Client
27
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
Slide 42
Slide 42 text
Ads
ovio Ad
ounter 1
ovio Ad
ounter 2
Riot Ad
ounter 1
Riot Ad
ounter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Rovio Ad
Counter
1
Ro
C
Rovio Ad
Counter
1
Ro
C
Rovio Ad
Counter
1
Ro
C
Rovio Ad
Counter
1
Ro
C
Client Side, Sing
28
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
Slide 43
Slide 43 text
Ads
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
move Read
Union
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
29
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
Slide 44
Slide 44 text
Ads
Contracts
Ads
Contracts
Ads
With
Contracts
Filter
Product
Read
Union
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
30
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
Slide 45
Slide 45 text
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
31
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
Slide 46
Slide 46 text
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Riot Ads
Rovio
Ads
Fil
Product
Read
50,000
Remove
Increment
Union
32
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
Slide 47
Slide 47 text
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
33
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
Slide 48
Slide 48 text
Advertisement Counter
• Completely monotonic
Disabling advertisements and contracts are all
modeled through monotonic state growth
34
Slide 49
Slide 49 text
Advertisement Counter
• Completely monotonic
Disabling advertisements and contracts are all
modeled through monotonic state growth
• Divergence
Divergence is a factor of synchronization period
34
Slide 50
Slide 50 text
Advertisement Counter
• Completely monotonic
Disabling advertisements and contracts are all
modeled through monotonic state growth
• Divergence
Divergence is a factor of synchronization period
• Arbitrary distribution
Use of convergent data structures allows
computational graph to be arbitrarily distributed
34
Slide 51
Slide 51 text
Client as processes
35
Slide 52
Slide 52 text
Client as processes
35
Server as cluster of nodes
in a hash ring
Slide 53
Slide 53 text
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
36
Server/Client Distribution
Slide 54
Slide 54 text
What if we want to have multiple
replication schemes used in a
single dataflow graph?
37
Slide 55
Slide 55 text
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
38
Geo-Replicated Distribution
Slide 56
Slide 56 text
Distribution Abstraction
• Previous model assumes Dynamo-style
Instead, allow nodes in the graph to represent objects that have their
own replication scheme
39
Slide 57
Slide 57 text
Distribution Abstraction
• Previous model assumes Dynamo-style
Instead, allow nodes in the graph to represent objects that have their
own replication scheme
• Each node in the dataflow graph:
39
Slide 58
Slide 58 text
Distribution Abstraction
• Previous model assumes Dynamo-style
Instead, allow nodes in the graph to represent objects that have their
own replication scheme
• Each node in the dataflow graph:
• Replicated state machine
39
Slide 59
Slide 59 text
Distribution Abstraction
• Previous model assumes Dynamo-style
Instead, allow nodes in the graph to represent objects that have their
own replication scheme
• Each node in the dataflow graph:
• Replicated state machine
• Dynamo-style “quorum-intersection”
39
Slide 60
Slide 60 text
Distribution Abstraction
• Previous model assumes Dynamo-style
Instead, allow nodes in the graph to represent objects that have their
own replication scheme
• Each node in the dataflow graph:
• Replicated state machine
• Dynamo-style “quorum-intersection”
• Single value
39
Slide 61
Slide 61 text
Distribution Abstraction
• Previous model assumes Dynamo-style
Instead, allow nodes in the graph to represent objects that have their
own replication scheme
• Each node in the dataflow graph:
• Replicated state machine
• Dynamo-style “quorum-intersection”
• Single value
• Epidemic broadcast for data propagation
Facilitates distribution of “program state” across nodes in the dataflow
graph
39
Slide 62
Slide 62 text
Selective Hearing
Semantics
40
Slide 63
Slide 63 text
Two Layer Approach
• Lasp
41
Slide 64
Slide 64 text
Two Layer Approach
• Lasp
• Variables and values are stored on all nodes
41
Slide 65
Slide 65 text
Two Layer Approach
• Lasp
• Variables and values are stored on all nodes
• Read operations:
41
Slide 66
Slide 66 text
Two Layer Approach
• Lasp
• Variables and values are stored on all nodes
• Read operations:
• Declare “interest” in a value
41
Slide 67
Slide 67 text
Two Layer Approach
• Lasp
• Variables and values are stored on all nodes
• Read operations:
• Declare “interest” in a value
• Store a continuation to invoke
Predicate function on a lattice position
41
Slide 68
Slide 68 text
Two Layer Approach
• Lasp
• Variables and values are stored on all nodes
• Read operations:
• Declare “interest” in a value
• Store a continuation to invoke
Predicate function on a lattice position
• Bind operations (update operations, as well):
41
Slide 69
Slide 69 text
Two Layer Approach
• Lasp
• Variables and values are stored on all nodes
• Read operations:
• Declare “interest” in a value
• Store a continuation to invoke
Predicate function on a lattice position
• Bind operations (update operations, as well):
• Bind a value on each “interested node”
This performs a merge with the nodes current value
41
Slide 70
Slide 70 text
Two Layer Approach
• Gossip
42
Slide 71
Slide 71 text
Two Layer Approach
• Gossip
• Weak ordering of broadcast messages
Variable state and metadata for declare and bind operations
42
Slide 72
Slide 72 text
Two Layer Approach
• Gossip
• Weak ordering of broadcast messages
Variable state and metadata for declare and bind operations
• Bind operations:
42
Slide 73
Slide 73 text
Two Layer Approach
• Gossip
• Weak ordering of broadcast messages
Variable state and metadata for declare and bind operations
• Bind operations:
• Uniquely identify messages
Pair of global message identifier and version vector
42
Slide 74
Slide 74 text
Two Layer Approach
• Gossip
• Weak ordering of broadcast messages
Variable state and metadata for declare and bind operations
• Bind operations:
• Uniquely identify messages
Pair of global message identifier and version vector
• Incremented by coordinating replica
When receiving incoming vector, merge with current vector and
advance
42
Slide 75
Slide 75 text
Two Layer Approach
• Gossip
• Weak ordering of broadcast messages
Variable state and metadata for declare and bind operations
• Bind operations:
• Uniquely identify messages
Pair of global message identifier and version vector
• Incremented by coordinating replica
When receiving incoming vector, merge with current vector and
advance
• Monotonic state increases per-replica
Ignore messages that have been subsumed by later messages
42
Slide 76
Slide 76 text
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Riot Ads
Rovio
Ads
Fil
Product
Read
50,000
Remove
Increment
Union
43
Ads
Rovio Ad
Counter 1
Rovio Ad
Counter 2
Riot Ad
Counter 1
Riot Ad
Counter 2
Contracts
Ads
Contracts
Ads
With
Contracts
Riot Ads
Rovio
Ads
Filter
Product
Read
50,000
Remove
Increment
Read
Union
Lasp Operation
User-Maintained CRDT
Lasp-Maintained CRDT
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Rovio Ad
Counter
1
Rovio Ad
Counter
2
Riot Ad
Counter
1
Client Side, Single Copy at Client
Slide 77
Slide 77 text
44
server({#ad{counter=Counter}=Ad, _}, Ads) ->
strict_read(Counter, 50000),
update(Ads, {remove, Ad}, Ad).
Ad Counter Process
Slide 78
Slide 78 text
44
server({#ad{counter=Counter}=Ad, _}, Ads) ->
strict_read(Counter, 50000),
update(Ads, {remove, Ad}, Ad).
Ad Counter Process
• Blocking read of the counter for value 50000
Slide 79
Slide 79 text
44
server({#ad{counter=Counter}=Ad, _}, Ads) ->
strict_read(Counter, 50000),
update(Ads, {remove, Ad}, Ad).
Ad Counter Process
• Blocking read of the counter for value 50000
• Records interest in variable Counter
Slide 80
Slide 80 text
44
server({#ad{counter=Counter}=Ad, _}, Ads) ->
strict_read(Counter, 50000),
update(Ads, {remove, Ad}, Ad).
Ad Counter Process
• Blocking read of the counter for value 50000
• Records interest in variable Counter
• Registers a continuation that will invoke when Counter >= 50000
Continuation
Slide 81
Slide 81 text
44
server({#ad{counter=Counter}=Ad, _}, Ads) ->
strict_read(Counter, 50000),
update(Ads, {remove, Ad}, Ad).
Ad Counter Process
• Blocking read of the counter for value 50000
• Records interest in variable Counter
• Registers a continuation that will invoke when Counter >= 50000
• Interest in variable Counter removed
Continuation
Slide 82
Slide 82 text
45
%% Create initial set.
S1 = declare(set),
%% Add elements to initial set and update.
update(S1, {add, [1,2,3]}),
%% Create second set.
S2 = declare(set),
%% Apply map operation between S1 and S2.
map(S1, fun(X) -> X * 2 end, S2).
Slide 83
Slide 83 text
46
Map Process
map(S1, Function, S2) -> map(S1, Function, Bottom(S1), S2).
map(S1, Function, Last, S2) ->
Continuation = fun(Current) ->
Result = compute(Function, Current),
bind(S2, Result),
map(S1, P, Current, S2)
end,
read(S1, fun(Current) -> Last < Current, Continuation).
Slide 84
Slide 84 text
47
Map Process
map(S1, Function, S2) -> map(S1, Function, Bottom(S1), S2).
map(S1, Function, Last, S2) ->
Continuation = fun(Current) ->
Result = compute(Function, Current),
bind(S2, Result),
map(S1, P, Current, S2)
end,
read(S1, fun(Current) -> Last < Current, Continuation).
Invoke Map
Slide 85
Slide 85 text
48
Map Process
map(S1, Function, S2) -> map(S1, Function, Bottom(S1), S2).
map(S1, Function, Last, S2) ->
Continuation = fun(Current) ->
Result = compute(Function, Current),
bind(S2, Result),
map(S1, P, Current, S2)
end,
read(S1, fun(Current) -> Last < Current, Continuation).
Generate continuation
Slide 86
Slide 86 text
49
Map Process
map(S1, Function, S2) -> map(S1, Function, Bottom(S1), S2).
map(S1, Function, Last, S2) ->
Continuation = fun(Current) ->
Result = compute(Function, Current),
bind(S2, Result),
map(S1, P, Current, S2)
end,
read(S1, fun(Current) -> Last < Current, Continuation).
Invoke continuation on change
Slide 87
Slide 87 text
What comes next?
50
Slide 88
Slide 88 text
Future Work
• Quantitative evaluation
Evaluation and optimization of the prototype
implementation in Erlang with Lasp and Plumtree
51
Slide 89
Slide 89 text
Future Work
• Quantitative evaluation
Evaluation and optimization of the prototype
implementation in Erlang with Lasp and Plumtree
• Extensions to increase locality
Local variables that do not get distributed
51
Slide 90
Slide 90 text
Future Work
• Quantitative evaluation
Evaluation and optimization of the prototype
implementation in Erlang with Lasp and Plumtree
• Extensions to increase locality
Local variables that do not get distributed
• Partial evaluation
Can we derive optimized distribution models
given dataflow execution graphs?
51
Slide 91
Slide 91 text
Conclusion
• Successful pairing
Pairing of a weak delivery model with a
model that does not rely on ordering
guarantees
52
Slide 92
Slide 92 text
Conclusion
• Successful pairing
Pairing of a weak delivery model with a
model that does not rely on ordering
guarantees
• Distributed epidemic-based runtime
First implementation of a epidemic
broadcast based runtime in a general
programming model
52
Slide 93
Slide 93 text
SyncFree is a European research project
taking place for 3 years, staring October
2013, and is funded by the European
Union, grant agreement n° 609551.
53