We Have a DREAM: Distributed Reac5ve Programming with - - PowerPoint PPT Presentation

we have a dream distributed reac5ve programming with
SMART_READER_LITE
LIVE PREVIEW

We Have a DREAM: Distributed Reac5ve Programming with - - PowerPoint PPT Presentation

We Have a DREAM: Distributed Reac5ve Programming with Consistency Guarantees Alessandro Margara, Guido Salvaneschi Presented by Wilfried Daniels Introduc5on


slide-1
SLIDE 1

We ¡Have ¡a ¡DREAM: ¡Distributed ¡ Reac5ve ¡Programming ¡with ¡ Consistency ¡Guarantees ¡

Alessandro ¡Margara, ¡Guido ¡Salvaneschi ¡

¡

Presented ¡by ¡Wilfried ¡Daniels ¡

slide-2
SLIDE 2

Introduc5on ¡

  • Designing, ¡implemen5ng ¡and ¡maintaining ¡

reac5ve ¡systems ¡is ¡difficult ¡

– Asynchronous ¡callbacks ¡ – Hard ¡to ¡trace/understand ¡control ¡flow ¡

¡è ¡Solu5on: ¡Reac5ve ¡Programming ¡

slide-3
SLIDE 3

Introduc5on ¡

  • Key ¡concepts: ¡

– 5me-­‑varying ¡values ¡ – tracking ¡of ¡dependencies ¡ – automa5c ¡propaga5on ¡of ¡changes ¡

1 var a: int = 10 2 var b: int = a + 2 3 println(b) // 12 4 a = 11 5 println(b) // 12 1 var a: int = 10 2 var b: int := a + 2 3 println(b) // 12 4 a = 11 5 println(b) // 13

Impera5ve ¡ Reac5ve ¡

slide-4
SLIDE 4

Introduc5on ¡

  • Advantages ¡vs. ¡classic ¡event-­‑based ¡arch: ¡

– No ¡explicit ¡update ¡logic ¡ – Declara5ve ¡specifica5on ¡of ¡dependencies ¡ – Run5me ¡manages ¡correct ¡propaga5on ¡(e.g. ¡glitch ¡ freeness/consistency) ¡

  • This ¡work ¡focuses ¡on ¡distributed ¡reac5ve ¡

programming ¡(DRP) ¡

slide-5
SLIDE 5

Introduc5on ¡

  • Previous ¡DRP ¡solu5ons ¡do ¡not ¡guarantee ¡

distributed ¡consistency ¡(only ¡local) ¡

  • This ¡paper ¡presents ¡DREAM ¡, ¡a ¡Distributed ¡

REAc/ve ¡Middleware ¡with ¡three ¡different ¡ levels ¡of ¡consistency ¡guarantees ¡

slide-6
SLIDE 6

Background ¡and ¡Mo5va5on ¡

  • Mo5va5on ¡for ¡different ¡levels ¡of ¡consistency ¡
  • Running ¡example: ¡financial ¡applica5on ¡system ¡

V1 V2 V3

1 var marketIndex = InputModule.getMarketIndex() 2 var stockOpts = InputModule.getStockOpts() 3 var news = InputModule.getNews() 4 5 // Forecasts according to different models 6 var f1 := Model1.compute(marketIndex,stockOpts) 7 var f2 := Model2.compute(marketIndex,stockOpts) 8 var f3 := Model3.compute(marketIndex,news) 9 10 var gui := Display.show(f1,f2,f3) 11 12 var financialAlert := ((f1+f2+f3)/3) < MAX 13 if (financialAlert) decrease(stockOpts) 14 15 var financialAlert_n := computeAlert_n(f1,f2,f3) 16 if (financialAlert_n) adjust_n(stockOpts)

Observable ¡ 5me-­‑varying ¡variables ¡ Dependent ¡ Reac5ve ¡expressions ¡ Reac5ve ¡expressions ¡ resul5ng ¡in ¡3 ¡ alterna5ve ¡outputs, ¡ each ¡requiring ¡ different ¡consistency ¡ guarantees ¡

slide-7
SLIDE 7

Background ¡and ¡Mo5va5on ¡

  • Variant ¡1: ¡Smartphone ¡app ¡

– Just ¡displays ¡output ¡of ¡3 ¡models ¡ – No ¡consistency ¡required ¡

  • Variant ¡2: ¡Models ¡aggregator ¡

– Aggregates ¡output ¡of ¡3 ¡models ¡ – Undertakes ¡ac5on ¡when ¡below ¡threshold ¡

V1

9 10 var gui := Display.show(f1,f2,f3) 11

V2

11 12 var financialAlert := ((f1+f2+f3)/3) < MAX 13 if (financialAlert) decrease(stockOpts) 14

slide-8
SLIDE 8

Background ¡and ¡Mo5va5on ¡

  • Variant ¡2: ¡Models ¡aggregator ¡

– Requires ¡glitch ¡freedom ¡ – Assume ¡ini5ally ¡f1:110, ¡f2:95, ¡f3:99 ¡with ¡MAX:100 ¡ – New ¡marketIndex: ¡all ¡models ¡recalculate. ¡ – Model ¡f1 ¡finishes ¡first ¡with ¡f1: ¡90 ¡

à ¡STOCKS ¡DECREASED ¡(GLITCH!) ¡

– Other ¡models ¡finish: ¡f2:111, ¡f3:103 ¡

V2

11 12 var financialAlert := ((f1+f2+f3)/3) < MAX 13 if (financialAlert) decrease(stockOpts) 14

slide-9
SLIDE 9

Background ¡and ¡Mo5va5on ¡

  • Variant ¡3: ¡Mul5ple ¡aggregators ¡

– f1, ¡f2, ¡f3 ¡are ¡dispatched ¡to ¡n ¡aggregators, ¡that ¡ work ¡autonomously ¡ – In ¡case ¡of ¡devia5ng ¡behaviour, ¡any ¡aggregator ¡can ¡ adjust ¡stockOpts ¡ – No ¡glitch ¡freedom ¡required, ¡but ¡every ¡single ¡ aggregator ¡needs ¡to ¡see ¡f1, ¡f2 ¡and ¡f3 ¡change ¡in ¡ the ¡same ¡order ¡

V3

14 15 var financialAlert_n := computeAlert_n(f1,f2,f3) 16 if (financialAlert_n) adjust_n(stockOpts)

slide-10
SLIDE 10

A ¡model ¡for ¡DRP ¡

  • Formal ¡defini5on ¡of ¡DRP ¡system ¡architecture/

consistency ¡guarantees ¡

  • Components: ¡networked ¡nodes ¡in ¡system ¡
  • Variables: ¡state ¡of ¡component ¡ ¡ ¡ ¡ ¡ ¡is ¡

represented ¡by ¡

ts c1 . . . cn

les Vi = {vi1 : τi1 . . . vim : τim}, me of variable j in component

t ci as

Communication Channel

c c c c c c c c c c c c

vi1 vi2 vin

slide-11
SLIDE 11

A ¡model ¡for ¡DRP ¡

  • Besides ¡tradi5onal ¡impera)ve ¡variables, ¡

reac)ve ¡and ¡observable ¡variables ¡are ¡defined ¡

  • Reac/ve: ¡variable ¡that ¡is ¡automa5cally ¡

updated ¡based ¡on ¡reac5ve ¡expression ¡

  • Observable: ¡con5nuously ¡changing ¡var ¡that ¡is ¡

used ¡to ¡build ¡expressions. ¡Local ¡or ¡Global. ¡

  • e.g. ¡stock ¡market: ¡

f3 ¡:= ¡Model3.compute(marketIndex,news) ¡ ¡

Reac5ve ¡(+ ¡observable) ¡variable ¡ Observable ¡variables ¡

slide-12
SLIDE 12

A ¡model ¡for ¡DRP ¡

  • Dependency ¡Graph: ¡

– Directed ¡graph ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡where ¡ ¡ ¡ ¡ ¡is ¡the ¡set ¡of ¡ all ¡observable/reac5ve ¡variables ¡and ¡ ¡ ¡ ¡is ¡the ¡set ¡of ¡ all ¡edges ¡that ¡connect ¡directly ¡depending ¡ variables ¡ – E.g. ¡stock ¡market ¡for ¡Variant ¡1 ¡+ ¡2: ¡

ph D = {V, E}, re V

  • f al

nd E

f1 f2 f3 marketIndex stockOpts gui financialAlert news

slide-13
SLIDE 13

A ¡model ¡for ¡DRP ¡

  • Events: ¡

– Write ¡event: ¡

  • Occurs ¡when ¡value ¡x ¡is ¡wrifen ¡to ¡variable ¡v ¡

– Read ¡event: ¡

  • Occurs ¡when ¡value ¡x ¡is ¡read ¡from ¡variable ¡v ¡

– Update ¡event: ¡

  • Depending ¡variable ¡v ¡is ¡reac5vely ¡update ¡with ¡value ¡x ¡

due ¡to ¡the ¡write ¡events ¡contained ¡in ¡the ¡set ¡S ¡ t wx(v) t rx(v) from a va

t u(S, wx(v)), S = {wy1(v1) . . . wyn(vn)}

slide-14
SLIDE 14

A ¡model ¡for ¡DRP ¡

  • Consistency ¡Guarantees ¡

– Exactly ¡once ¡delivery: ¡ensures ¡that, ¡in ¡absence ¡of ¡ failure, ¡the ¡communica5on ¡channel ¡does ¡not ¡lose ¡

  • r ¡duplicate ¡an ¡update. ¡More ¡formally: ¡

¡ ¡ ¡ ¡ ¡

If ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡occurs, ¡then ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡occurs ¡ exactly ¡once. ¡

¡

  • nly onc

if wx(v) e and onl

ables depending on v. More u(Si, wy(vi)), wx(v) ∈ Si such that v depends on v.

slide-15
SLIDE 15

A ¡model ¡for ¡DRP ¡

  • Consistency ¡Guarantees ¡

– FIFO ¡ordering: ¡changes ¡to ¡a ¡a ¡variable ¡ ¡ ¡ ¡in ¡a ¡ component ¡ ¡ ¡are ¡propagated ¡to ¡depending ¡ reac5ve ¡expressions ¡in ¡the ¡same ¡order ¡they ¡occur ¡ in ¡ ¡. ¡More ¡formally: ¡ ¡ ¡ ¡ ¡ ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡such ¡that ¡ ¡ ¡ ¡ ¡depends ¡on ¡ ¡ ¡ ¡ ¡, ¡if ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡occurs ¡ before ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡then ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡occurs ¡before ¡

¡

∀vi, vj t vj n u( n vi, i ) ∈ S

, if wx1(vi) re wx2(vi) (v ) ∈ S n u(S1), wx1(vi) ∈ S1 re u(S2),

x2 i

wx2(vi) ∈ S2.

ble v

in c. in c.

slide-16
SLIDE 16

A ¡model ¡for ¡DRP ¡

  • Consistency ¡Guarantees ¡

– Causal ¡ordering: ¡ensures ¡that ¡events ¡that ¡are ¡causally ¡ connected ¡occur ¡in ¡every ¡component ¡in ¡the ¡same ¡

  • rder. ¡More ¡formally: ¡

– No ¡guarantees ¡are ¡made ¡for ¡events ¡that ¡are ¡not ¡ causally ¡connected! ¡ ¡ ¡ ¡ ¡ ¡

We ¡define ¡a ¡happened ¡before ¡( ¡ ¡ ¡ ¡ ¡) ¡par5al ¡order ¡rela5on: ¡

  • If ¡two ¡events ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡occur ¡in ¡the ¡same ¡process, ¡then ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡and ¡
  • nly ¡if ¡ ¡ ¡ ¡ ¡occurs ¡before ¡ ¡ ¡ ¡
  • If ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡then ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡

(a ¡write ¡happens ¡before ¡an ¡update ¡depending ¡on ¡it) ¡

  • If ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡and ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡then ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(transi5vity) ¡

(→)

ts e1, e2

n e1 → e2

if e1 re e2

if e1 = wx(vi) and e2 = u(Si, wy(vj)), wx(vi) ∈ Si,

n e1 → e2 n e1 → e2

e2 → e3, n e1 → e3

slide-17
SLIDE 17

A ¡model ¡for ¡DRP ¡

  • Consistency ¡Guarantees ¡

– Glitch ¡freedom: ¡no ¡par5al ¡updates ¡due ¡to ¡ propaga5on ¡delays. ¡More ¡formally: ¡ ¡ ¡ ¡ ¡ ¡

Consider ¡the ¡set ¡ ¡ ¡ ¡, ¡containing ¡all ¡observable ¡variables ¡a ¡ reac5ve ¡variable ¡ ¡ ¡depends ¡on. ¡Let ¡us ¡call ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡the ¡ set ¡of ¡variables ¡that ¡depend ¡directly ¡or ¡indirectly ¡from ¡a ¡ variable ¡ ¡ ¡ ¡. ¡The ¡update ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡is ¡a ¡par)al ¡update ¡ if ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡. ¡A ¡glitch ¡free ¡system ¡does ¡not ¡have ¡par5al ¡

  • updates. ¡

¡

ble v

s Vd. ariable v tha ll Vd1 ⊆ Vd

v u(S, wx(v))

nd S ⊂ Vd1

ble v1

slide-18
SLIDE 18

A ¡model ¡for ¡DRP ¡

  • Consistency ¡Guarantees ¡

– Atomic ¡consistency: ¡ensures ¡that: ¡(i) ¡the ¡system ¡ provides ¡FIFO ¡ordering, ¡and ¡(ii) ¡every ¡write ¡event ¡ to ¡an ¡observable ¡variable ¡is ¡atomically ¡propagated ¡ to ¡all ¡(in)directly ¡depending ¡reac5ve ¡variables. ¡ More ¡formally: ¡ – This ¡is ¡stricter ¡than ¡glitch ¡freedom ¡

All ¡the ¡update ¡events ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡triggered ¡(directly ¡or ¡ indirectly) ¡by ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡are ¡executed ¡as ¡a ¡single ¡opera5on ¡

¡

s u(Si, wy(vi)) by wx(v)

slide-19
SLIDE 19

DREAM: ¡API ¡

  • DREAM ¡is ¡en5rely ¡wrifen ¡in ¡Java ¡
  • Observable ¡variables ¡à ¡observable ¡objects ¡

– Inherit ¡from ¡Observable ¡abstract ¡class ¡ – All ¡non-­‑void ¡methods: ¡observable ¡methods ¡ – Generic ¡method ¡m ¡that ¡poten5ally ¡changes ¡return ¡ value ¡of ¡observable ¡method ¡obm: ¡m ¡impacts ¡obm ¡ – Impacts ¡should ¡be ¡known ¡by ¡run5me ¡

à ¡Java ¡Annota5ons ¡

slide-20
SLIDE 20

DREAM: ¡API ¡

  • Example ¡of ¡observable ¡class ¡represen5ng ¡an ¡

integer: ¡

1 public class ObservableInteger extends Observable { 2

private int val;

3 4

// Constructors ...

5 6

@ImpactsOn(methods = { "get" })

7

public final void set(int val) {

8

this.val = val;

9

}

10 11

public final int get() {

12

return val;

13

}

14 }

slide-21
SLIDE 21

DREAM: ¡API ¡

  • Reac5ve ¡variables ¡à ¡Reac5ve ¡objects ¡
  • Created ¡by ¡using ¡the ¡ReactiveFactory ¡class ¡

– Parses ¡reac5ve ¡expressions ¡(strings ¡with ¡ANTLR) ¡ – Reac5ve ¡objects ¡can ¡be ¡observable ¡(op5onal) ¡

  • Naming ¡space: ¡

– Unique ¡name: ¡c.obj.obm ¡for ¡observable ¡method ¡

  • bm ¡of ¡object ¡obj ¡in ¡component ¡c ¡

– For ¡local ¡objects: ¡obj.obm ¡

slide-22
SLIDE 22

DREAM: ¡API ¡

  • Example: ¡ ¡

1 // Component c1 2 ObservableInteger obInt = 3

new ObservableInteger("obInt1", 1, LOCAL);

4 ObservableString obStr1 = 5

new ObservableString("obStr1", "a", GLOBAL);

6 ObservableString obStr2 = ... 7 8 // Component c2 9 ReactiveInteger rInt = ReactiveFactory. 10

getInteger("obInt.get()*2");

11 ReactiveString rStr = ReactiveFactory. 12

getString("obStr1.get()+obStr2.get()");

13 while(true){ 14

System.out.println(rStr.get())

15

Thread.sleep(500)

16 } 17 18 // Component c3 19 ReactiveInteger strLen = 20

ReactiveFactory.getObservableInteger

21

("c1.obString1.get().length()", "obString1Len");

slide-23
SLIDE 23

DREAM: ¡Implementa5on ¡

  • Architecture ¡consists ¡of ¡two ¡parts: ¡

– A ¡client ¡library ¡on ¡every ¡component ¡ – A ¡distributed ¡event-­‑based ¡infrastructure, ¡ consis5ng ¡of ¡brokers ¡

  • Brokers ¡form ¡an ¡acyclic ¡overlay ¡network, ¡
  • ffering ¡communica5on ¡between ¡components ¡
  • Op5onal ¡registry ¡for ¡persistence ¡
slide-24
SLIDE 24

DREAM: ¡Implementa5on ¡

  • Architecture ¡overview ¡

Watcher B B B B B B R

c c c c c c c c c c c c

CommunicationManager Reactive Object Observable Object

Subscribe Notify Advertise/Notify

slide-25
SLIDE 25

DREAM: ¡Implementa5on ¡

  • Pub-­‑Sub ¡Communica/on: ¡

Clients ¡register ¡with ¡brokers ¡through ¡3 ¡primi5ves: ¡

– advertise(c,obj,obm): ¡used ¡by ¡c ¡if ¡it ¡has ¡a ¡

globally ¡observable ¡method ¡obj.obm() ¡

– subscribe(c,obj,obm): ¡used ¡to ¡register ¡a ¡

component ¡that ¡has ¡a ¡reac5ve ¡expression ¡ containing ¡c.obj.obm() ¡

– notify(c,obj,obm,val): ¡used ¡by ¡c ¡when ¡

  • bj.obm() ¡has ¡a ¡new ¡value ¡val ¡
slide-26
SLIDE 26

DREAM: ¡Implementa5on ¡

  • Clients ¡

– CommunicationManager: ¡

  • Proxy ¡for ¡global ¡communica5on ¡
  • Manage ¡local ¡communica5on ¡

– Observable ¡objects: ¡

  • Have ¡Watcher ¡code ¡woven ¡in ¡through ¡AOP ¡
  • Watcher ¡interacts ¡with ¡CommunicationManager ¡to: ¡
  • 1. Adver5se ¡new ¡objects ¡through ¡advertise(c,obj,obm) ¡
  • 2. Detect ¡changes ¡to ¡observables ¡and ¡propagate ¡them ¡out ¡

through ¡notify(c,obj,obm,val) ¡

slide-27
SLIDE 27

DREAM: ¡Implementa5on ¡

  • Clients ¡

– Reac5ve ¡Objects: ¡

  • When ¡instan5ated, ¡for ¡all ¡relevant ¡observable ¡methods ¡

¡à ¡subscribe(c,obj,obm) ¡with ¡CommunicationManager ¡

  • When ¡new ¡values ¡available, ¡no5fica5on ¡from ¡

CommunicationManager ¡

slide-28
SLIDE 28

DREAM: ¡Implementa5on ¡

  • Architecture ¡overview ¡

Watcher B B B B B B R

c c c c c c c c c c c c

CommunicationManager Reactive Object Observable Object

Subscribe Notify Advertise/Notify

slide-29
SLIDE 29

DREAMS: ¡Implementa5on ¡

  • Brokers ¡

Run ¡REDS ¡event ¡dispatching ¡ – Brokers ¡are ¡connected ¡in ¡acyclic ¡graph ¡ – Adver5sements ¡are ¡propagated ¡through ¡graph ¡+ ¡ stored ¡by ¡all ¡brokers, ¡remembering ¡next ¡hop ¡ – When ¡a ¡broker ¡receives ¡a ¡subscrip5on, ¡store ¡in ¡ table ¡and ¡forward ¡to ¡next ¡hop ¡(retrace ¡path ¡of ¡ adver5sements) ¡

slide-30
SLIDE 30

DREAMS: ¡Implementa5on ¡

  • Consistency ¡ ¡Guarantees ¡

– Causal ¡ordering: ¡

  • Use ¡point ¡to ¡point ¡TCP ¡for ¡broker-­‑broker ¡and ¡client-­‑

broker ¡communica5on ¡

  • Use ¡single ¡thread ¡for ¡FIFO ¡event ¡processing ¡

¡ à ¡These ¡2 ¡proper5es ¡with ¡an ¡acyclic ¡topology ¡are ¡ sufficient ¡for ¡causal ¡ordering ¡

slide-31
SLIDE 31

DREAMS: ¡Implementa5on ¡

  • Consistency ¡ ¡Guarantees ¡

– Glitch ¡freedom: ¡

  • New ¡reac5ve ¡object: ¡push ¡propagate ¡expression ¡to ¡ ¡ ¡ ¡ ¡

all ¡brokers ¡à ¡each ¡broker ¡has ¡dependency ¡graph ¡

  • When ¡a ¡chain ¡of ¡opera5ons ¡is ¡triggered, ¡always ¡include ¡

the ¡original ¡write ¡event ¡that ¡caused ¡it ¡in ¡ communica5ons ¡

  • Local ¡communica5on ¡has ¡to ¡go ¡through ¡a ¡broker ¡as ¡

well ¡to ¡ensure ¡glitch ¡freedom ¡ à ¡This ¡informa5on ¡is ¡enough ¡for ¡the ¡brokers ¡to ¡schedule ¡ propaga5on ¡in ¡a ¡way ¡that ¡avoids ¡par5al ¡updates ¡

slide-32
SLIDE 32

DREAMS: ¡Implementa5on ¡

  • Consistency ¡ ¡Guarantees ¡

– Atomic ¡ordering: ¡

  • Adds ¡centralized ¡Ticket ¡Gran5ng ¡Service ¡(TGS) ¡
  • When ¡a ¡write ¡event ¡occurs, ¡all ¡it’s ¡directly ¡and ¡

indirectly ¡dependent ¡reac5ve ¡expressions ¡are ¡ reevaluated ¡atomically ¡(no ¡other ¡write ¡opera5ons) ¡

  • On ¡write: ¡get ¡5cket, ¡wait ¡in ¡line ¡and ¡be ¡served ¡one ¡at ¡a ¡

5me ¡ à ¡This ¡entails ¡glitch ¡freedom ¡and ¡is ¡an ¡even ¡stronger ¡ consistency ¡guarantee ¡

slide-33
SLIDE 33

Evalua5on ¡

  • Twofold: ¡
  • 1. Large ¡scale ¡emula5on: ¡Cost ¡of ¡DRP ¡protocols ¡

with ¡different ¡levels ¡of ¡consistency ¡guarantees/ varying ¡parameters. ¡KPIs: ¡

  • Average ¡propaga5on ¡delay ¡(ms) ¡ ¡
  • Network ¡wide ¡traffic ¡throughput ¡(KB/s) ¡
  • 2. Real-­‑world ¡run5me ¡overheads ¡
slide-34
SLIDE 34

Evalua5on ¡

  • Default ¡values ¡for ¡emula5on: ¡

Number of brokers 10 Number of components 50 Topology of broker network Scale-free Percentage of pure forwarders 50% Distribution of components Uniform Link latency 1 ms–5 ms Number of reactive graphs 10 Size of dependency graphs 5 Size of reactive expressions 2 Degree of locality in expressions 0.8 Frequency of change for observable objects 1 change/s

slide-35
SLIDE 35

Evalua5on ¡

  • Advantages ¡of ¡distribu/on ¡

– 1 ¡broker ¡vs. ¡10 ¡brokers ¡ – Causal: ¡no ¡big ¡impact ¡– ¡mainly ¡due ¡to ¡locality ¡ – Glitch ¡free: ¡all ¡propaga5on ¡through ¡broker ¡

à ¡Having ¡mul5ple ¡brokers ¡helps ¡

– Atomic: ¡adds ¡TGS ¡delay ¡+ ¡traffic ¡

à ¡Same ¡advantages ¡when ¡mul5ple ¡brokers ¡

Delay (ms) Traffic (KB/s) Centr. Distr. Centr. Distr. Causal 4.77 4.76 68.3 69.8 Glitch free 29.53 17.18 205.4 130.9 Atomic 53.41 26.75 265.5 161.3

slide-36
SLIDE 36

Evalua5on ¡

  • Locality ¡of ¡expressions ¡

– General ¡trend: ¡locality ¡cuts ¡costs ¡

10 20 30 40 50 60 0.2 0.4 0.6 0.8 1 Average Delay (ms) Degree of Locality Causal Glitch Free Atomic

(a) Delay

100 200 300 400 500 0.2 0.4 0.6 0.8 1 Overall Traffic (KB/s) Degree of Locality Causal Glitch Free Atomic

(b) Traffic Completely ¡local ¡+ ¡causal ¡= ¡0 ¡costs ¡ Completely ¡remote ¡+ ¡causal ¡= ¡glitches! ¡

slide-37
SLIDE 37

Degree of Locality 10 20 30 40 50 60 2 4 6 8 10 12 14 16 Average Delay (ms) Number of Objects per Graph Causal Glitch Free Atomic

(a) Delay

200 400 600 800 1000 2 4 6 8 10 12 14 16 Overall Traffic (KB/s) Number of Objects per Graph Causal Glitch Free Atomic

(b) Traffic

Evalua5on ¡

  • Size ¡of ¡reac/ve ¡graphs ¡

– General ¡trend: ¡large ¡reac5ve ¡graphs ¡increase ¡costs ¡

Long ¡chains ¡of ¡reac5ve ¡vars ¡+ ¡causal ¡= ¡glitches! ¡

slide-38
SLIDE 38

20 40 60 80 100 1 2 3 4 5 6 7 8 Average Delay (ms) Number of Objects per Expression Causal Glitch Free Atomic

(a) Delay

200 400 600 800 1000 1200 1400 1600 1 2 3 4 5 6 7 8 Overall Traffic (KB/s) Number of Objects per Expression Causal Glitch Free Atomic

(b) Traffic

Evalua5on ¡

  • Size ¡of ¡expressions ¡

– General ¡trend: ¡bigger ¡expressions ¡increase ¡costs ¡

More ¡vars/expression ¡+ ¡causal ¡= ¡glitches! ¡

slide-39
SLIDE 39

Evalua5on ¡

  • Run/me ¡overheads ¡

– Overheads ¡consis5ng ¡of: ¡

  • Intercep5ng ¡a ¡method ¡call ¡
  • Serializing/deserializing ¡
  • Propaga5ng ¡the ¡change ¡
  • Evalua5ng ¡reac5ve ¡expression ¡

– Local ¡scenario: ¡two ¡clients ¡and ¡a ¡broker ¡on ¡1 ¡ machine, ¡with ¡increasing ¡expression ¡length ¡

slide-40
SLIDE 40

Evalua5on ¡

  • Run/me ¡overheads ¡

– Conclusion: ¡run5me ¡overheads ¡are ¡minimal ¡

0.5 1 1.5 2 2.5 3 3.5 4 1 10 100 1000 Propagation Delay (ms) Number of Operators Causal Glitch Free Atomic

slide-41
SLIDE 41

Conclusion ¡

  • Key ¡contribu5ons: ¡

– First ¡abstract ¡model ¡of ¡DRP/formalizing ¡ consistency ¡constraints ¡ – DREAM: ¡a ¡first ¡DRP ¡middleware ¡suppor5ng ¡3 ¡ propaga5on ¡seman5cs ¡ – A ¡thorough ¡evalua5on ¡of ¡the ¡costs ¡

slide-42
SLIDE 42

Conclusion ¡

  • Future ¡work: ¡

– A ¡glitch ¡free ¡protocol ¡that ¡takes ¡advantage ¡of ¡ locality ¡ – Robustness ¡in ¡case ¡of ¡node ¡failure ¡ – More ¡complex ¡expressions ¡(5me ¡series ¡and ¡ sequence ¡of ¡changes) ¡ – Different ¡evalua5on ¡strategies ¡(lazy, ¡incremental) ¡ to ¡improve ¡efficiency ¡ – More ¡real ¡applica5ons ¡