Declarative, Secure, Convergent, Edge Computation

Declarative, Secure, Convergent, Edge Computation

Erlang Factory 2016
San Francisco, CA

3e09fee7b359be847ed5fa48f524a3d3?s=128

Christopher Meiklejohn

March 10, 2016
Tweet

Transcript

  1. Declarative, Secure, Convergent Edge Computation Christopher Meiklejohn Erlang Factory 2016,

    March 10th, 2016 1
  2. Example Application Hospital Refrigerators 2

  3. Hospital Refrigerators Typical Topology 3

  4. 4

  5. Internet 5

  6. Internet HDFS 6

  7. Internet HDFS Hadoop Client Client Internet 7

  8. Internet HDFS Hadoop Client Client Internet Spark Client Client Internet

    8
  9. Hospital Refrigerators Ideal Execution 9

  10. Internet HDFS Spark 10

  11. Internet HDFS Spark 35F 11

  12. Internet HDFS Spark 35F 12

  13. Internet HDFS Spark 35F 40F 13

  14. Internet HDFS Spark 35F 40F 14

  15. Client Internet HDFS Spark 35F 40F 15

  16. Problem Connectivity 16

  17. Internet HDFS Spark 17

  18. Internet HDFS Spark 35F 18

  19. Internet HDFS Spark 35F 19

  20. Internet HDFS Spark 35F 40F 20

  21. Internet HDFS Spark 35F 40F 21

  22. Internet HDFS Spark 35F 40F 40F 22

  23. Internet HDFS Spark 35F 40F 40F 23

  24. Solution Local Decisions 24

  25. Internet HDFS Spark 25

  26. Internet HDFS Spark 35F 26

  27. Internet HDFS Spark 35F 27

  28. Internet HDFS Spark 35F 40F 28

  29. Internet HDFS Spark 35F 40F 29

  30. Solution Transitive Dissemination 30

  31. Internet HDFS Spark 31

  32. Internet HDFS Spark 35F 32

  33. Internet HDFS Spark 35F 33

  34. Internet HDFS Spark 35F 40F 34

  35. Internet HDFS Spark 35F 40F 35

  36. Internet HDFS Spark 35F 40F Client 36

  37. Problem State Transmission 37

  38. Internet 38

  39. Internet 35F 39

  40. Internet 35F 35F 35F 35F 40

  41. Internet 35F 35F 35F 35F 41

  42. Solution Aggregate Dissemination 42

  43. Internet 43

  44. Internet OK NO OK 44

  45. Internet OK OK OK OK OK NO OK OK OK

    45
  46. Internet OK OK OK OK OK NO OK OK OK

    HDFS OK OK OK OK OK OK OK OK NO 46
  47. Internet OK OK OK OK OK NO OK OK OK

    OK OK OK OK OK OK OK OK NO = = HDFS OK OK OK OK OK OK OK NO 47
  48. Internet OK OK OK OK OK NO OK OK OK

    ? OK OK OK OK OK OK OK OK NO = = 48
  49. Internet OK OK OK OK OK NO OK OK OK

    ? OK OK OK OK OK OK OK OK NO = = 49
  50. Local Computation • Reduce state transmission
 Perform some local computation

    to reduce transmitted state on the wire 50
  51. Local Computation • Reduce state transmission
 Perform some local computation

    to reduce transmitted state on the wire • Make local decisions
 Make decisions based on results of local computation 50
  52. Databases Consistency Models 51

  53. Databases Strong Consistency 52

  54. R1 C1 C2 53

  55. R1 C1 C2 Value 1 54

  56. R1 C1 C2 Read Value 1 Value 1 Value 1

    55
  57. R1 C1 C2 Read Value 1 Value 1 Value 1

    Value 1 56
  58. R1 C1 C2 CAS Value 1 with Value 2 Value

    2 Value 1 Value 2 57
  59. R1 C1 C2 CAS Value 1 with Value 3 Value

    2 Value 1 Value 2 58
  60. I won’t diagram the Paxos protocol 59

  61. R2 C1 C2 Value 2 Value 1 Value 2 R1

    R3 Paxos 60
  62. Databases Eventual Consistency 61

  63. R1 R2 R3 C1 C2 62

  64. R1 R2 R3 C1 C2 Value 1 @ [1, 0,

    0] Value 1 @ [1, 0, 0] Value 1 @ [1, 0, 0] 63
  65. R1 R2 R3 C1 C2 Value 1 @ [1, 0,

    0] Value 1 @ [1, 0, 0] Value 1 @ [1, 0, 0] Value 1 @ [1, 0, 0] 64
  66. R1 R2 R3 C1 C2 Value 1 @ [1, 0,

    0] Value 1 @ [1, 0, 0] Value 1 @ [1, 0, 0] Value 1 @ [1, 0, 0] Value 1 @ [1, 0, 0] 65
  67. R1 R2 R3 C1 C2 Value 1 @ [1, 0,

    0] Value 1 @ [1, 0, 0] Value 1 @ [1, 0, 0] Value 1 @ [1, 0, 0] Value 1 @ [1, 0, 0] Write 2 66
  68. R1 R2 R3 C1 C2 Value 2 @ [2, 0,

    0] Value 2 @ [2, 0, 0] Value 2 @ [2, 0, 0] Value 2 @ [2, 0, 0] Value 1 @ [1, 0, 0] Write 2 Write Value 2 @ [2, 0, 0] 67
  69. R1 R2 R3 C1 C2 Value 2 @ [2, 0,

    0] Value 3 @ [1, 0, 1] Value 2 @ [2, 0, 0] Value 3 @ [1, 0, 1] Value 2 @ [2, 0, 0] Value 3 @ [1, 0, 1] Value 2 @ [2, 0, 0] Value 2 @ [2, 0, 0] Value 3 @ [1, 0, 1] Write 3 68
  70. R1 R2 R3 C1 C2 Value 2 @ [2, 0,

    0] Value 3 @ [1, 0, 1] Value 2 @ [2, 0, 0] Value 3 @ [1, 0, 1] Value 2 @ [2, 0, 0] Value 3 @ [1, 0, 1] Value 2 @ [2, 0, 0] Value 3 @ [1, 0, 1] Value 2 @ [2, 0, 0] Value 3 @ [1, 0, 1] 69
  71. R1 R2 R3 C1 C2 Value 4 @ [2, 0,

    1] Value 4 @ [2, 0, 1] Value 4 @ [2, 0, 1] Value 4 @ [2, 0, 1] Value 2 @ [2, 0, 0] Value 3 @ [1, 0, 1] Write 4 70
  72. Eventual Consistency As The Model 71

  73. Clients Own Their Data 72

  74. OK OK OK 73

  75. OK OK OK OK OK OK OK OK OK 74

  76. OK OK OK OK OK OK OK OK OK 75

  77. OK OK OK OK OK OK OK 76

  78. OK OK OK OK OK OK OK OK OK 77

  79. Computations Mergability & Provenance 78

  80. A A B C 79

  81. A A B C D’ D’’ F F 80

  82. A A B C D’ D’’ D’ D’’ D 

     F F 81
  83. D’’ A A B C D’ D’ D’’ D 

     D D Merge F F 82
  84. Example Application Preliminary Results 83

  85. Preliminary Results • Conflict-Free Replicated Data Types
 Distributed data structures

    designed for convergence 
 [Shapiro et al., 2011] 84
  86. Preliminary Results • Conflict-Free Replicated Data Types
 Distributed data structures

    designed for convergence 
 [Shapiro et al., 2011] • Lattice Processing
 Make decisions based on results of local computation
 [Meiklejohn & Van Roy, 2015] 84
  87. Preliminary Results • Conflict-Free Replicated Data Types
 Distributed data structures

    designed for convergence 
 [Shapiro et al., 2011] • Lattice Processing
 Make decisions based on results of local computation
 [Meiklejohn & Van Roy, 2015] • Selective Hearing
 Epidemic broadcast based runtime system
 [Meiklejohn & Van Roy, 2015/2016] 84
  88. Conflict-Free 
 Replicated Data Types • Collection of types
 Sets,

    counters, registers, flags, maps 85
  89. Conflict-Free 
 Replicated Data Types • Collection of types
 Sets,

    counters, registers, flags, maps • Strong Eventual Consistency
 Objects that receive the same updates, regardless of order, will reach equivalent state 85
  90. RA RB RC

  91. RA RB RC {1} (1, {a}, {}) add(1)

  92. RA RB RC {1} (1, {a}, {}) add(1) {1} (1,

    {c}, {}) add(1)
  93. RA RB RC {1} (1, {a}, {}) add(1) {1} (1,

    {c}, {}) add(1) {} (1, {c}, {c}) remove(1)
  94. RA RB RC {1} (1, {a}, {}) add(1) {1} (1,

    {c}, {}) add(1) {} (1, {c}, {c}) remove(1) {1} {1} {1} (1, {a, c}, {c}) (1, {a, c}, {c}) (1, {a, c}, {c})
  95. Lattice Processing • Distributed, deterministic dataflow
 Distributed, dataflow programming model

    91
  96. Lattice Processing • Distributed, deterministic dataflow
 Distributed, dataflow programming model

    • Convergent data structures
 Data abstraction is the CRDT 91
  97. Lattice Processing • Distributed, deterministic dataflow
 Distributed, dataflow programming model

    • Convergent data structures
 Data abstraction is the CRDT • Enables composition
 Composition preserves SEC 91
  98. 92 %% 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).
  99. 93 %% 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).
  100. 94 %% 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).
  101. 95 %% 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).
  102. 96 %% 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).
  103. Selective Hearing • Epidemic broadcast protocol
 Runtime system for application

    state & scope 97
  104. Selective Hearing • Epidemic broadcast protocol
 Runtime system for application

    state & scope • Peer-to-peer dissemination
 Pairwise synchronization between peers without a central coordinator 97
  105. Selective Hearing • Epidemic broadcast protocol
 Runtime system for application

    state & scope • Peer-to-peer dissemination
 Pairwise synchronization between peers without a central coordinator • No ordering guarantees on messages
 Programming model can tolerate message reordering and duplication 97
  106. What can we build? Leaderboard 98

  107. Leaderboard • Mobile game platform
 Local leaderboard tracking top-k highest

    scored games 99
  108. Leaderboard • Mobile game platform
 Local leaderboard tracking top-k highest

    scored games • Clients will go offline
 Clients have limited connectivity and the system still needs to make progress while clients are offline 99
  109. Client 1 Leaderboard Client 3 Leaderboard Client 2 Leaderboard Lasp

    Operation User-Maintained CRDT Lasp-Maintained CRDT 100
  110. Leaderboard • Peer-to-peer dissemination
 Nodes periodically “merge” their state with

    a random peer 101
  111. Leaderboard • Peer-to-peer dissemination
 Nodes periodically “merge” their state with

    a random peer • Complexity in the data type
 Each node tracks a top-k set of its own games in a bounded set 101
  112. 102 %% Create a leaderboard datatype. L = declare({top_k, [2]}).

    %% Update leaderboard. update({set, Name, Score}, L).
  113. 103 %% Create a leaderboard datatype. L = declare({top_k, [2]}).

    %% Update leaderboard. update({set, Name, Score}, L).
  114. 104 %% Create a leaderboard datatype. L = declare({top_k, [2]}).

    %% Update leaderboard. update({set, Name, Score}, L).
  115. What if we want to enhance the behavior? 105

  116. What if we want to enhance the behavior? 105 Without

    the creation of a new datatype
  117. What can we build? Per-User Leaderboard 106 EdgeCom 2016

  118. Per-User Leaderboard • Enhance existing design
 Only the top score

    for each user at each device 107
  119. Per-User Leaderboard • Enhance existing design
 Only the top score

    for each user at each device • Minimize transmitted state
 Prevent transmission of state that is not necessary to perform the computation 107
  120. Per-User Leaderboard • Enhance existing design
 Only the top score

    for each user at each device • Minimize transmitted state
 Prevent transmission of state that is not necessary to perform the computation • Compose data types
 Build a per-user leaderboard through the composition of existing types 107
  121. Client1 Scores Local Top-K Fold Global Top-K Lasp Operation Input

    User-Maintained CRDT Output Lasp-Maintained CRDT Fold Client3 Scores Local Top-K Fold Global Top-K Fold Client2 Scores Local Top-K Fold Global Top-K Fold 108
  122. Client1 Scores Local Top-K Fold Global Top-K Fold 109 Client1

    Scores Local Top-K Fold Global Top-K Fold Client3 Scores Local Top-K Fold Global Top-K Fold Client2 Scores Local Top-K Fold Global Top-K Fold
  123. Client1 Scores Local Top-K Fold Global Top-K Fold 110 Client1

    Scores Local Top-K Fold Global Top-K Fold Client3 Scores Local Top-K Fold Global Top-K Fold Client2 Scores Local Top-K Fold Global Top-K Fold
  124. Client1 Scores Local Top-K Fold Global Top-K Fold 111 Client1

    Scores Local Top-K Fold Global Top-K Fold Client3 Scores Local Top-K Fold Global Top-K Fold Client2 Scores Local Top-K Fold Global Top-K Fold
  125. Client1 Scores Local Top-K Fold Global Top-K Fold 112 Client1

    Scores Local Top-K Fold Global Top-K Fold Client3 Scores Local Top-K Fold Global Top-K Fold Client2 Scores Local Top-K Fold Global Top-K Fold
  126. Client1 Scores Local Top-K Fold Global Top-K Fold 113 Client1

    Scores Local Top-K Fold Global Top-K Fold Client3 Scores Local Top-K Fold Global Top-K Fold Client2 Scores Local Top-K Fold Global Top-K Fold
  127. Client1 Scores Local Top-K Fold Global Top-K Fold 114 Client1

    Scores Local Top-K Fold Global Top-K Fold Client3 Scores Local Top-K Fold Global Top-K Fold Client2 Scores Local Top-K Fold Global Top-K Fold
  128. Client1 Scores Local Top-K Fold Global Top-K Lasp Operation Input

    User-Maintained CRDT Output Lasp-Maintained CRDT Fold Client3 Scores Local Top-K Fold Global Top-K Fold Client2 Scores Local Top-K Fold Global Top-K Fold 115 Client1 Scores Local Top-K Fold Global Top-K Fold Client3 Scores Local Top-K Fold Global Top-K Fold Client2 Scores Local Top-K Fold Global Top-K Fold
  129. Per-User Leaderboard • Dynamically scoped variables
 Variable which take different

    values depending on where it is executing 116
  130. Per-User Leaderboard • Dynamically scoped variables
 Variable which take different

    values depending on where it is executing • Dynamically scoped fold operation
 Perform a distributed “reduce” operation that combines the state of a dynamically scoped variables across 116
  131. 117 %% Create a global leaderboard. G = declare({top_k, [10]}).

    %% Create a local leaderboard. L = declare_dynamic({top_k, [10]}). %% Create a set of scores. S = declare_dynamic(set). %% Compute local top-k list. fold(S, fun max_by_name/2, L). %% Compute global top-k list. fold_dynamic(L, fun max_by_name/2, G).
  132. 118 %% Create a global leaderboard. G = declare({top_k, [10]}).

    %% Create a local leaderboard. L = declare_dynamic({top_k, [10]}). %% Create a set of scores. S = declare_dynamic(set). %% Compute local top-k list. fold(S, fun max_by_name/2, L). %% Compute global top-k list. fold_dynamic(L, fun max_by_name/2, G).
  133. 119 %% Create a global leaderboard. G = declare({top_k, [10]}).

    %% Create a local leaderboard. L = declare_dynamic({top_k, [10]}). %% Create a set of scores. S = declare_dynamic(set). %% Compute local top-k list. fold(S, fun max_by_name/2, L). %% Compute global top-k list. fold_dynamic(L, fun max_by_name/2, G).
  134. 120 %% Create a global leaderboard. G = declare({top_k, [10]}).

    %% Create a local leaderboard. L = declare_dynamic({top_k, [10]}). %% Create a set of scores. S = declare_dynamic(set). %% Compute local top-k list. fold(S, fun max_by_name/2, L). %% Compute global top-k list. fold_dynamic(L, fun max_by_name/2, G).
  135. 121 %% Create a global leaderboard. G = declare({top_k, [10]}).

    %% Create a local leaderboard. L = declare_dynamic({top_k, [10]}). %% Create a set of scores. S = declare_dynamic(set). %% Compute local top-k list. fold(S, fun max_by_name/2, L). %% Compute global top-k list. fold_dynamic(L, fun max_by_name/2, G).
  136. 122 %% Create a global leaderboard. G = declare({top_k, [10]}).

    %% Create a local leaderboard. L = declare_dynamic({top_k, [10]}). %% Create a set of scores. S = declare_dynamic(set). %% Compute local top-k list. fold(S, fun max_by_name/2, L). %% Compute global top-k list. fold_dynamic(L, fun max_by_name/2, G).
  137. Let’s look at a larger application 123

  138. Let’s look at a larger application 123 With visible 


    non-monotonicity
  139. What can we build? Advertisement Counter 124

  140. Advertisement Counter • Mobile game platform selling advertisement space
 Advertisements

    are paid according to a minimum number of impressions 125
  141. 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 125
  142. 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 126
  143. 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 127 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
  144. 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 128 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
  145. 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 129 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
  146. 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 130 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
  147. 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 131 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
  148. 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 132 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
  149. 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 133 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
  150. 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 134 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
  151. Advertisement Counter • Completely monotonic
 Disabling advertisements and contracts are

    all modeled through monotonic state growth 135
  152. Advertisement Counter • Completely monotonic
 Disabling advertisements and contracts are

    all modeled through monotonic state growth • Arbitrary distribution
 Use of convergent data structures allows computational graph to be arbitrarily distributed 135
  153. Advertisement Counter • Completely monotonic
 Disabling advertisements and contracts are

    all modeled through monotonic state growth • Arbitrary distribution
 Use of convergent data structures allows computational graph to be arbitrarily distributed • Divergence
 Divergence is a factor of synchronization period 135
  154. Client3 Lasp Operation User-Maintained CRDT Lasp-Maintained CRDT Riot Ad Counter

    1 Client1 Client2 Rovio Ad Counter 1 Rovio Ad Counter 2 Rovio Ad Counter 1 Rovio Ad Counter 2 Rovio Ad Counter 1 Riot Ad Counter 2 Riot Ad Counter 1 Riot Ad Counter 1 Ads With Contracts Ads With Contracts Ads With Contracts Server Ads With Contracts Server Computation! 136
  155. Client3 Lasp Operation User-Maintained CRDT Lasp-Maintained CRDT Riot Ad Counter

    1 Client1 Client2 Rovio Ad Counter 1 Rovio Ad Counter 2 Rovio Ad Counter 1 Rovio Ad Counter 2 Rovio Ad Counter 1 Riot Ad Counter 2 Riot Ad Counter 1 Riot Ad Counter 1 Ads With Contracts Ads With Contracts Ads With Contracts Server Ads With Contracts Server Computation! 137
  156. Client3 Lasp Operation User-Maintained CRDT Lasp-Maintained CRDT Riot Ad Counter

    1 Client1 Client2 Rovio Ad Counter 1 Rovio Ad Counter 2 Rovio Ad Counter 1 Rovio Ad Counter 2 Rovio Ad Counter 1 Riot Ad Counter 2 Riot Ad Counter 1 Riot Ad Counter 1 Ads With Contracts Ads With Contracts Ads With Contracts Server Ads With Contracts Server Computation! 138
  157. Advertisement Counter • “Servers” as peers to “clients”
 Servers are

    peers to clients that perform additional computation 139
  158. Advertisement Counter • “Servers” as peers to “clients”
 Servers are

    peers to clients that perform additional computation • Any node can disable an advertisement under this model given enough information 139
  159. Advertisement Counter • “Servers” as peers to “clients”
 Servers are

    peers to clients that perform additional computation • Any node can disable an advertisement under this model given enough information • “Servers” as trusted nodes
 Serve as a location for performing “exactly once” side- effects 139
  160. Advertisement Counter • “Servers” as peers to “clients”
 Servers are

    peers to clients that perform additional computation • Any node can disable an advertisement under this model given enough information • “Servers” as trusted nodes
 Serve as a location for performing “exactly once” side- effects • Billing customers must be done at a central point by a trusted node in the system 139
  161. We’ve build up from zero synchronization 140

  162. We’ve build up from zero synchronization 140 Instead of working

    to remove synchronization
  163. Challenges Looking Ahead 141

  164. Causality State Explosion 142

  165. Set Counter

  166. Set Counter {1} (1, {c}, {}) 1 {(c, 1)}, {}

  167. Set Counter {1} (1, {c}, {}) 1 {(c, 1)}, {}

    {} (1, {c}, {c}) {(c, 1)}, {(c, 1)} 0
  168. Set Counter {1} (1, {c}, {}) 1 {(c, 1)}, {}

    {} (1, {c}, {c}) {(c, 1)}, {(c, 1)} 0 {1} (1, {a, c}, {c}) {1} 1 1 {(c, 1), (a, 1}}, {(c, 1)}
  169. Security Computing at the Edge 147

  170. OK OK OK 148

  171. Computations Expressiveness 149

  172. How restrictive is a programming model where operations must be

    associative, commutative, and idempotent? 150
  173. What’s new? 151

  174. Since Erlang Factory 2015 • Erlang 18, rebar3, Common Test


    Faster test suite, on Erlang 18 with rebar3 152
  175. Since Erlang Factory 2015 • Erlang 18, rebar3, Common Test


    Faster test suite, on Erlang 18 with rebar3 • No Riak Core
 Plumtree distribution replaces the Riak Core distribution system 152
  176. Since Erlang Factory 2015 • Erlang 18, rebar3, Common Test


    Faster test suite, on Erlang 18 with rebar3 • No Riak Core
 Plumtree distribution replaces the Riak Core distribution system • No NIFs
 Allows us to cross-compile to other platforms and not worry about NIF scheduling 152
  177. Semantics Improvements • Delta-State Based Conflict-Free Replicated Data Types
 Optimized

    state dissemination by shipping deltas 
 [Almeida et al., 2016] 153
  178. Semantics Improvements • Delta-State Based Conflict-Free Replicated Data Types
 Optimized

    state dissemination by shipping deltas 
 [Almeida et al., 2016] • Causal CRDTs
 Optimized, garbage-free data structure support
 [Almeida et al., 2016; Meiklejohn 2016, in review] 153
  179. Semantics Improvements • Delta-State Based Conflict-Free Replicated Data Types
 Optimized

    state dissemination by shipping deltas 
 [Almeida et al., 2016] • Causal CRDTs
 Optimized, garbage-free data structure support
 [Almeida et al., 2016; Meiklejohn 2016, in review] • Fold
 New semantics for a more expressive fold operation for arbitrary computation over sets
 [Meiklejohn 2016, in review] 153
  180. Runtime Improvements • Delta-State Based Anti-Entropy
 Optimized AAE mechanism based

    on deltas
 [Almeida et al., 2016] 154
  181. Runtime Improvements • Delta-State Based Anti-Entropy
 Optimized AAE mechanism based

    on deltas
 [Almeida et al., 2016] • Mesos and Docker Enabled
 Run large-scale Lasp clusters on Mesos with Marathon
 [Meiklejohn and Yoo 2016, in review] 154
  182. Runtime Improvements • Delta-State Based Anti-Entropy
 Optimized AAE mechanism based

    on deltas
 [Almeida et al., 2016] • Mesos and Docker Enabled
 Run large-scale Lasp clusters on Mesos with Marathon
 [Meiklejohn and Yoo 2016, in review] • Loquat
 Epidemic broadcast, partially replicated with Decentralized Information Flow Control
 [Meiklejohn 2016, in review] 154
  183. Lasp Simulator • Docker Containers
 Docker containers for EPMD and

    Lasp runtime system 155
  184. Lasp Simulator • Docker Containers
 Docker containers for EPMD and

    Lasp runtime system • Service Discovery
 Mechanisms for clustering Erlang nodes based on either Marathon application definitions of Mesos-DNS 155
  185. Lasp Simulator • Docker Containers
 Docker containers for EPMD and

    Lasp runtime system • Service Discovery
 Mechanisms for clustering Erlang nodes based on either Marathon application definitions of Mesos-DNS • Instrumentation
 Transmission instrumentation and divergence measurement 155
  186. Lasp Simulator • Plumtree VM-to-VM
 VM-to-VM communication performed using the

    Plumtree epidemic broadcast protocol 156
  187. Lasp Simulator • Plumtree VM-to-VM
 VM-to-VM communication performed using the

    Plumtree epidemic broadcast protocol • Clients-as-processes
 Multiple clients per virtual machine, acting as mobile/IoT devices that periodically simulate and can be partitioned 156
  188. Lasp Simulator • Plumtree VM-to-VM
 VM-to-VM communication performed using the

    Plumtree epidemic broadcast protocol • Clients-as-processes
 Multiple clients per virtual machine, acting as mobile/IoT devices that periodically simulate and can be partitioned • “Design in the small, run in the large”
 Runtime configuration change for client-to-VM ratio, allows for single laptop design of multi-machine evaluations of the programming model 156
  189. 157

  190. �� ��� ��� ��� ���� � �� ��� ��� ���

    ��� ��� ���������� �� � �� ������ ���� �� ������� ������� ���������� ��������� ����� ������� ���������� ��������� �� 158
  191. ������� ������ ����� ���� ��� � � � � ��

    ��� ��� ��� ��� ��� ��������� ����������� ���� �� ������� ������� ��������� ������� ���������� ������ 159
  192. What’s next? 160

  193. Google Summer of Code (and my Ph.D.!) • Partial Evaluation


    Optimize execution based on analysis and annotations where we can determine local-vs-remote usage 161
  194. Google Summer of Code (and my Ph.D.!) • Partial Evaluation


    Optimize execution based on analysis and annotations where we can determine local-vs-remote usage • Optimizations
 General optimizations of the Erlang implementation of Lasp to improve performance of the runtime system 161
  195. Google Summer of Code (and my Ph.D.!) • Partial Evaluation


    Optimize execution based on analysis and annotations where we can determine local-vs-remote usage • Optimizations
 General optimizations of the Erlang implementation of Lasp to improve performance of the runtime system • Elixir / Macros
 Provide a nicer way for working with Lasp, outside of the current syntax. 161
  196. How do I learn more? 162

  197. Publications • “Lasp: A Language for Distributed, Coordination-Free Programming” 


    ACM SIGPLAN PPDP 2015 • “Selective Hearing: An Approach to Distributed, Eventually Consistent Edge Computation”
 IEEE W-PSDS 2015 • “The Implementation and Use of a Generic Dataflow Behaviour in Erlang”
 ACM SIGPLAN Erlang Workshop ’15 • “Lasp: A Language for Distributed, Eventually Consistent Computations with CRDTs"
 PaPoC 2015 • “Declarative, Sliding Window Aggregations for Computations at the Edge"
 IEEE EdgeCom 2016 163
  198. 164 Christopher Meiklejohn @cmeik http://www.lasp-lang.org Thanks!