diamond: automating data management and storage for wide ... · diamond: automating data management...

82
Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro Fonseca Brandon Holt Raymond Cheng Ariadna Norberg Arvind Krishnamurthy Henry M. Levy 1

Upload: others

Post on 10-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond: Automating Data Management and Storage

for Wide-area, Reactive Applications

Irene Zhang Niel Lebeck Pedro Fonseca Brandon Holt Raymond Cheng

Ariadna Norberg Arvind Krishnamurthy Henry M. Levy

1

Page 2: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond: Automating Data Management and Storage

for Wide-area, Reactive Applications

Irene Zhang Niel Lebeck Pedro Fonseca Brandon Holt Raymond Cheng

Ariadna Norberg Arvind Krishnamurthy Henry M. Levy

1

Page 3: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Reactive applications automatically propagate updates across mobile devices and the cloud.

2

Page 4: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

0 0Irene Niel

Pin The Advisor

0 0IreneNiel

Reactive applications automatically propagate updates across mobile devices and the cloud.

2

Page 5: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

0 0Irene Niel

Pin The Advisor

0 0IreneNiel

You earned 5 pts!

Reactive applications automatically propagate updates across mobile devices and the cloud.

5

2

Page 6: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

0 0Irene Niel

Pin The Advisor

0 0IreneNiel

5

Reactive applications automatically propagate updates across mobile devices and the cloud.

5

2

It’s your turn!

Page 7: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

0 0Irene Niel

Pin The Advisor

0 0IreneNiel

5

Reactive applications automatically propagate updates across mobile devices and the cloud.

Availability5

2

It’s your turn!

Page 8: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

0 0Irene Niel

Pin The Advisor

0 0IreneNiel

5

Reactive applications automatically propagate updates across mobile devices and the cloud.

Fault-tolerance

Availability5

2

It’s your turn!

Page 9: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

0 0Irene Niel

Pin The Advisor

0 0IreneNiel

5

Reactive applications automatically propagate updates across mobile devices and the cloud.

Fault-tolerance

Availability Consistency5

2

It’s your turn!

Page 10: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

5 0Irene Niel

You earned 5 pts!

Which poses a challenge for app programmers.

Pin The Advisor

0 0IreneNiel

3

Page 11: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

5 0Irene Niel

You earned 5 pts!

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

Which poses a challenge for app programmers.

Pin The Advisor

0 0IreneNiel

3

Page 12: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

5 0Irene Niel

You earned 5 pts!

irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

Which poses a challenge for app programmers.

Pin The Advisor

0 0IreneNiel

3

Page 13: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

5 0Irene Niel

You earned 5 pts!

irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

Which poses a challenge for app programmers.

5

Pin The Advisor

0 0IreneNiel

3

Page 14: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

5 0Irene Niel

You earned 5 pts!

irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

Which poses a challenge for app programmers.

5

niel

Pin The Advisor

0 0IreneNiel

3

Page 15: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

5 0Irene Niel

You earned 5 pts!

irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

write

Which poses a challenge for app programmers.

5

niel

5

niel

Pin The Advisor

0 0IreneNiel

3

Page 16: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

1Pin The Advisor

5 0Irene Niel

You earned 5 pts!

irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

write

Which poses a challenge for app programmers.

5

niel

5

niel

Pin The Advisor

0 0IreneNiel

3

Page 17: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

1Pin The Advisor

5 0Irene Niel

You earned 5 pts!

irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

write

Which poses a challenge for app programmers.

5

niel

5

niel

Pin The Advisor

0 0IreneNiel

3

NotificationService

Page 18: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

1Pin The Advisor

5 0Irene Niel

You earned 5 pts!

irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

write

notify

Which poses a challenge for app programmers.

5

niel

5

niel

Pin The Advisor

0 0IreneNiel

notify

3

NotificationService

2

3

Page 19: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

1Pin The Advisor

5 0Irene Niel

You earned 5 pts!

read 4irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

write

notify

Which poses a challenge for app programmers.

5

niel

5

niel

Pin The Advisor

0 0IreneNiel

notify

5

niel 5

3

NotificationService

2

3

It’s your turn!

Page 20: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

1read 4irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

write

notify

Which poses a challenge for app programmers.

5

niel

5

niel

Pin The Advisor

0 0IreneNiel

notify

5

niel 5

3

NotificationService

2

3

It’s your turn!

Page 21: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

1 4irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

write

Which poses a challenge for app programmers.

5

niel

5

niel

Pin The Advisor

0 0IreneNiel

3

NotificationService

2

3

Page 22: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

1Pin The Advisor

5 0Irene Niel

You earned 5 pts!

4irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

write

Which poses a challenge for app programmers.

5

niel

5

niel

Pin The Advisor

0 0IreneNiel

3

NotificationService

2

3

Page 23: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

1Pin The Advisor

5 0Irene Niel

You earned 5 pts!

4irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

write

Which poses a challenge for app programmers.

5

niel

5

niel

This is a complex, distributed data management problem!

Pin The Advisor

0 0IreneNiel

3

NotificationService

2

3

Page 24: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

1Pin The Advisor

5 0Irene Niel

You earned 5 pts!

4irene 0

niel 0

turn irene

Storage

player1 0

player1 0

turn irene

Appplayer1 0

player1 0

turn irene

App

write

Which poses a challenge for app programmers.

5

niel

5

niel

This is a complex, distributed data management problem!

Pin The Advisor

0 0IreneNiel

3

NotificationService

Conclusion: Reactive applications require end-to-end data management with strong guarantees.

2

3

Page 25: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Which poses a challenge for app programmers.

4

Conclusion: Reactive applications require end-to-end data management with strong guarantees.

Page 26: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Which poses a challenge for app programmers.

4

Conclusion: Reactive applications require end-to-end data management with strong guarantees.

Page 27: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Which poses a challenge for app programmers.

4

Conclusion: Reactive applications require end-to-end data management with strong guarantees.

Page 28: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Which poses a challenge for app programmers.

4

Conclusion: Reactive applications require end-to-end data management with strong guarantees.

Page 29: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Which poses a challenge for app programmers.

4

Conclusion: Reactive applications require end-to-end data management with strong guarantees.

Page 30: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Which poses a challenge for app programmers.

4

Conclusion: Reactive applications require end-to-end data management with strong guarantees.

Page 31: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond

Diamond is the first reactive data management service, which provides the following guarantees:

• Ensures updates to shared data are consistent and durable

• Coordinates and synchronizes updates reliably across mobile clients and cloud storage

• Automatically triggers application code in response to updates to shared data

5

Page 32: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Talk OutlineDiamond System & Programming ModelWhat does Diamond provide for reactive apps?

Diamond Guarantees & ImplementationWhat does Diamond guarantee for reactive apps?

EvaluationHow does Diamond impact app complexity and performance?

6

Page 33: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Distributed Key-Value Store

Diamond System Model

Front-end Servers

Diamond Cloud

App Process

Client Devices

libDiamond

App Process

libDiamond

7

Page 34: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Programming Model

Diamond Cloud

App

libDiamond

Store App

libDiamond8

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Types (RDTs) Shared, persistent data structures

Page 35: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

0 0Irene Niel

PinAdvisor.cc x - +

• Simple data structures including primitives (e.g., string, long), collections (e.g., list) and Conflict-free Data Types (e.g., counter, set)

• Data type semantics avoid false sharing and enable commutative operations

• Defined in libDiamond language bindings

App

libDiamond

9

Reactive Data Types (RDTs) Shared, persistent data structures

Page 36: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

0 0Irene Niel

PinAdvisor.cc x - +

• Simple data structures including primitives (e.g., string, long), collections (e.g., list) and Conflict-free Data Types (e.g., counter, set)

• Data type semantics avoid false sharing and enable commutative operations

• Defined in libDiamond language bindings

DCounter player1;

player1

App

libDiamond

9

Reactive Data Types (RDTs) Shared, persistent data structures

Page 37: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

0 0Irene Niel

PinAdvisor.cc x - +

• Simple data structures including primitives (e.g., string, long), collections (e.g., list) and Conflict-free Data Types (e.g., counter, set)

• Data type semantics avoid false sharing and enable commutative operations

• Defined in libDiamond language bindings

DCounter player1;DCounter player2;

player1

player2

App

libDiamond

9

Reactive Data Types (RDTs) Shared, persistent data structures

Page 38: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

0 0Irene Niel

PinAdvisor.cc x - +

• Simple data structures including primitives (e.g., string, long), collections (e.g., list) and Conflict-free Data Types (e.g., counter, set)

• Data type semantics avoid false sharing and enable commutative operations

• Defined in libDiamond language bindings

DCounter player1;DCounter player2;DString turn;

player1

player2

turn

App

libDiamond

9

Reactive Data Types (RDTs) Shared, persistent data structures

Page 39: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1

player2

turn

App

libDiamond

Storeplayer1

player2

turn

App

libDiamond

Diamond Programming Model

10

Reactive Data Types (RDTs) Shared, persistent data structures

Page 40: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1

player2

turn

App

libDiamond

Storeplayer1

player2

turn

App

libDiamond

Diamond Programming Model

10

Reactive Data Types (RDTs) Shared, persistent data structures

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Page 41: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloudplayer1

player2

turn

App

libDiamond

Store

PinAdvisor.cc x - +

• Key abstraction for providing flexible, shared memory

• Gives apps control over what app data is shared and how it is organized

• Enables Diamond to automatically provide availability, fault-tolerance and consistency to RDTs

11

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Page 42: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloudplayer1

player2

turn

App

libDiamond

irene

Store

PinAdvisor.cc x - +

rmap(player1, “irene”);

• Key abstraction for providing flexible, shared memory

• Gives apps control over what app data is shared and how it is organized

• Enables Diamond to automatically provide availability, fault-tolerance and consistency to RDTs

11

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Page 43: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloudplayer1

player2

turn

App

libDiamond

irene

niel

Store

PinAdvisor.cc x - +

rmap(player1, “irene”);rmap(player2, “niel”);

• Key abstraction for providing flexible, shared memory

• Gives apps control over what app data is shared and how it is organized

• Enables Diamond to automatically provide availability, fault-tolerance and consistency to RDTs

11

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Page 44: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloudplayer1

player2

turn

App

libDiamond

irene

niel

turn

Store

PinAdvisor.cc x - +

rmap(player1, “irene”);rmap(player2, “niel”);rmap(turn, “turn”);

• Key abstraction for providing flexible, shared memory

• Gives apps control over what app data is shared and how it is organized

• Enables Diamond to automatically provide availability, fault-tolerance and consistency to RDTs

11

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Page 45: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1

player2

turn

App

libDiamond

irene

niel

turn

Storeplayer1

player2

turn

App

libDiamond

Diamond Programming Model

12

Reactive Data Types (RDTs) Shared, persistent data structures

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Page 46: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1

player2

turn

App

libDiamond

irene

niel

turn

Storeplayer1

player2

turn

App

libDiamond

Diamond Programming Model

12

Reactive Data Types (RDTs) Shared, persistent data structures

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Page 47: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

player1

player2

turn

App

Diamond Cloud

irene

niel

turn

Store

libDiamondPinAdvisor.cc x - +

• Execute application code to update rmapped RDTs

• Gives application programmers control over when to synchronize shared data

• Ensures safe concurrent access to shared data

13

Read-write TransactionsRead-write transactions to update shared RDTs.

Page 48: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

player1

player2

turn

App

Diamond Cloud

irene

niel

turn

Store

libDiamond

begin();PinAdvisor.cc x - +

• Execute application code to update rmapped RDTs

• Gives application programmers control over when to synchronize shared data

• Ensures safe concurrent access to shared data

13

Read-write TransactionsRead-write transactions to update shared RDTs.

Page 49: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

player1

player2

turn

App

Diamond Cloud

irene

niel

turn

Store

libDiamond

begin();player1 = 0;

0

PinAdvisor.cc x - +

• Execute application code to update rmapped RDTs

• Gives application programmers control over when to synchronize shared data

• Ensures safe concurrent access to shared data

13

Read-write TransactionsRead-write transactions to update shared RDTs.

Page 50: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

player1

player2

turn

App

Diamond Cloud

irene

niel

turn

Store

libDiamond

begin();player1 = 0;player2 = 0;

0

0

PinAdvisor.cc x - +

• Execute application code to update rmapped RDTs

• Gives application programmers control over when to synchronize shared data

• Ensures safe concurrent access to shared data

13

Read-write TransactionsRead-write transactions to update shared RDTs.

Page 51: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

player1

player2

turn

App

Diamond Cloud

irene

niel

turn

Store

libDiamond

begin();player1 = 0;player2 = 0;turn = “irene”;

0

0

irene

PinAdvisor.cc x - +

• Execute application code to update rmapped RDTs

• Gives application programmers control over when to synchronize shared data

• Ensures safe concurrent access to shared data

13

Read-write TransactionsRead-write transactions to update shared RDTs.

Page 52: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

player1

player2

turn

App

Diamond Cloud

irene

niel

turn

Store

libDiamond

0

0

irene

begin();player1 = 0;player2 = 0;turn = “irene”;commit();

0

0

irene

PinAdvisor.cc x - +

• Execute application code to update rmapped RDTs

• Gives application programmers control over when to synchronize shared data

• Ensures safe concurrent access to shared data

13

Read-write TransactionsRead-write transactions to update shared RDTs.

Page 53: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1

player2

turn

App

libDiamond

irene

niel

turn

Storeplayer1

player2

turn

App

libDiamond

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Diamond Programming Model

14

Reactive Data Types (RDTs) Shared, persistent data structures

Read-write TransactionsRead-write transactions to update shared RDTs.

0

0

irene

0

0

irene

0

0

irene

Page 54: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1

player2

turn

App

libDiamond

irene

niel

turn

Storeplayer1

player2

turn

App

libDiamond

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Diamond Programming Model

14

Reactive Data Types (RDTs) Shared, persistent data structures

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

0

0

irene

0

0

irene

0

0

irene

Page 55: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

Irene Niel

player1 0

player2 0

turn irene

App

libDiamondPinAdvisor.cc x - +

• Key abstraction for automatically propagating updates to local data

• Gives apps a consistent view of shared data and control over what to sync

• Automatically triggers app code in response to updates from read-write transactions to shared RDTs

15

Reactive Transactions Read-only transactions that re-execute app code when the read set updates.

Page 56: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

Irene Niel

player1 0

player2 0

turn irene

App

libDiamondPinAdvisor.cc x - +

• Key abstraction for automatically propagating updates to local data

• Gives apps a consistent view of shared data and control over what to sync

• Automatically triggers app code in response to updates from read-write transactions to shared RDTs

registerReactiveTxn

15

Reactive Transactions Read-only transactions that re-execute app code when the read set updates.

Page 57: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Pin The Advisor

Irene Niel

player1 0

player2 0

turn irene

App

libDiamond 00

irene

PinAdvisor.cc x - +

• Key abstraction for automatically propagating updates to local data

• Gives apps a consistent view of shared data and control over what to sync

• Automatically triggers app code in response to updates from read-write transactions to shared RDTs

registerReactiveTxn(displayUI(player1,

player2,turn));

15

It’s your turn!

Reactive Transactions Read-only transactions that re-execute app code when the read set updates.

Page 58: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1 0

player2 0

turn irene

App

libDiamond

irene 0

niel 0

turn irene

Storeplayer1 0

player2 0

turn irene

App

libDiamond

Diamond Programming Model

Pin The Advisor

0 0IreneNiel

Pin The Advisor

0 0Irene Niel

5

16

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Types (RDTs) Shared, persistent data structures

Page 59: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1 0

player2 0

turn irene

App

libDiamond

irene 0

niel 0

turn irene

Storeplayer1 0

player2 0

turn irene

App

libDiamond

Diamond Programming Model

Pin The Advisor

0 0IreneNiel

Pin The Advisor

0 0Irene Niel

You earned 5 pts!

55

16

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Types (RDTs) Shared, persistent data structures

Page 60: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1 0

player2 0

turn irene

App

libDiamond

irene 0

niel 0

turn irene

Storeplayer1 0

player2 0

turn irene

App

libDiamond

Diamond Programming Model

Pin The Advisor

0 0IreneNiel

Pin The Advisor

0 0Irene Niel

You earned 5 pts!

55

16

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Types (RDTs) Shared, persistent data structures

Page 61: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1 0

player2 0

turn irene

App

libDiamond

irene 0

niel 0

turn irene

Storeplayer1 0

player2 0

turn irene

App

libDiamond

Diamond Programming Model

Pin The Advisor

0 0IreneNiel

Pin The Advisor

0 0Irene Niel

5

niel

You earned 5 pts!

5

begin

commit5

16

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Types (RDTs) Shared, persistent data structures

Page 62: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1 0

player2 0

turn irene

App

libDiamond

irene 0

niel 0

turn irene

Storeplayer1 0

player2 0

turn irene

App

libDiamond

Diamond Programming Model

Pin The Advisor

0 0IreneNiel

Pin The Advisor

0 0Irene Niel

5

niel

You earned 5 pts!

5

begin

commit5

16

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Types (RDTs) Shared, persistent data structures

Page 63: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1 0

player2 0

turn irene

App

libDiamond

irene 0

niel 0

turn irene

Storeplayer1 0

player2 0

turn irene

App

libDiamond

Diamond Programming Model

Pin The Advisor

0 0IreneNiel

Pin The Advisor

0 0Irene Niel

5

niel

5

niel

5

niel

You earned 5 pts!

5

begin

commit5

16

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Types (RDTs) Shared, persistent data structures

Page 64: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1 0

player2 0

turn irene

App

libDiamond

irene 0

niel 0

turn irene

Storeplayer1 0

player2 0

turn irene

App

libDiamond

Diamond Programming Model

Pin The Advisor

0 0IreneNiel

Pin The Advisor

0 0Irene Niel

5

niel

5

niel

5

niel

You earned 5 pts!

5

begin

commit5

16

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Types (RDTs) Shared, persistent data structures

Page 65: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1 0

player2 0

turn irene

App

libDiamond

irene 0

niel 0

turn irene

Storeplayer1 0

player2 0

turn irene

App

libDiamond

Diamond Programming Model

Pin The Advisor

0 0IreneNiel

Pin The Advisor

0 0Irene Niel

5

niel

5

niel

5

niel

You earned 5 pts!

5

begin

commit5 5

16

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Types (RDTs) Shared, persistent data structures

It’s your turn!

Page 66: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Cloud

player1 0

player2 0

turn irene

App

libDiamond

irene 0

niel 0

turn irene

Storeplayer1 0

player2 0

turn irene

App

libDiamond

Diamond Programming Model

Pin The Advisor

0 0IreneNiel

Pin The Advisor

0 0Irene Niel

5

niel

5

niel

5

niel

You earned 5 pts!

5

begin

commit5 5

16

Reactive TransactionsRead-only transactions that re-execute app code when the read set updates.

Reactive Data Map (rmap) Binding between RDTs in the app and the Diamond store

Read-write TransactionsRead-write transactions to update shared RDTs.

Reactive Data Types (RDTs) Shared, persistent data structures

It’s your turn!Automated end-to-end data management and storage with

fault-tolerance, availability and consistency

Page 67: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Talk Outline

17

Diamond System & Programming ModelWhat does Diamond provide for reactive apps?

Diamond Guarantees & ImplementationWhat does Diamond guarantee for reactive apps?

EvaluationHow does Diamond impact app complexity and performance?

Automated end-to-end data management and storage.

Page 68: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond ACID+R Guarantees

18

Atomicity - All or no updates to shared data in a read-write transaction complete.

Consistency - All accesses in a transaction (read-write or reactive) reflect a single, point-in-time view of shared data.

Isolation - All transactions reflect a serial execution order over shared data.

Durability - All updates in committed transactions are never lost.

Reactivity - All accesses in reactive transactions will eventually reflect the latest updates.

Page 69: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Isolation Levels

Read-write Isolation Level Reactive Isolation Level

Strict Serializability Serializable Snapshot

Snapshot Isolation Serializable Snapshot

Read Committed Read Committed

Stronger Guarantees

BetterPerformance

19

Page 70: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond Implementation

• Data-type Optimistic Concurrency Control

• Multi-versioned caching • Data Push Notifications

Alice libDiamond Front-end Back-end

read(a)

<1,[11,13)>

gettimestamp

Front-end libDiamond Bob

write(b,1)

commit prepare

validation

okokcommit

pub(b,1,16) notify

(b,1,16) re-execread(b)

register

read(b,14)

<0,[11,15)>reg(14,[b])sub

(b,14)ex

ec

ute

co

mm

it

callback

Read-Write Transaction Reactive Transaction

Re

gis

te

rN

otif

y

Diamond Transaction Protocol Wide-area Optimizations

Take a look at the paper!

Page 71: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Talk Outline

21

Diamond System & Programming ModelWhat does Diamond provide for reactive apps?

Automated end-to-end data management and storage. Diamond Guarantees & ImplementationWhat does Diamond guarantee for reactive apps?

EvaluationHow does Diamond impact app complexity and performance?

Strong ACID+R transactional guarantees

Page 72: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Evaluation Overview

• Does Diamond simplify reactive applications?

• How does Diamond perform compare to a hand coded implementation?

• Testbed: Google Compute Engine VMs (5 shards x 3 replicas)

• Workload: Retwis-based Twitter benchmark

22

Page 73: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond reduces the complexity and improves the guarantees of reactive apps.

Application Original LoC Diamond LoC % Saved

Multi-player Game 46 34 26%

Chat Room 335 225 33%

Scrabble clone 8729 7603 13%

Twitter clone 14,278 12,554 13%

23

Page 74: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond reduces the complexity and improves the guarantees of reactive apps.

Application Original LoC Diamond LoC % Saved

Multi-player Game 46 34 26%

Chat Room 335 225 33%

Scrabble clone 8729 7603 13%

Twitter clone 14,278 12,554 13%

23

No UI.Mostly

sync code.

Page 75: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond reduces the complexity and improves the guarantees of reactive apps.

Application Original LoC Diamond LoC % Saved

Multi-player Game 46 34 26%

Chat Room 335 225 33%

Scrabble clone 8729 7603 13%

Twitter clone 14,278 12,554 13%

23

No UI.Mostly

sync code.

Full UI.Complex app logic.

Page 76: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond reduces the complexity and improves the guarantees of reactive apps.

Application Original LoC Diamond LoC % Saved

Multi-player Game 46 34 26%

Chat Room 335 225 33%

Scrabble clone 8729 7603 13%

Twitter clone 14,278 12,554 13%

23

No UI.Mostly

sync code.

Full UI.Complex app logic.

+durability

+durability+consistency

+durability

+isolation

+reactivity

+reactivity

Page 77: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond’s data management has low overhead.Th

roug

hput

(t

xn/s

ec)

0K

8K

16K

24K

32K

Redis DiamondRead

Committed

DiamondStrict

Serializability24

Page 78: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond’s data management has low overhead.Th

roug

hput

(t

xn/s

ec)

0K

8K

16K

24K

32K

Redis DiamondRead

Committed

DiamondStrict

Serializability

-2.1%

24

Page 79: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond’s data management has low overhead.Th

roug

hput

(t

xn/s

ec)

0K

8K

16K

24K

32K

Redis DiamondRead

Committed

DiamondStrict

Serializability

-2.1% Weak Consistency

StrongConsistency

24

Page 80: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Diamond’s data management has low overhead.Th

roug

hput

(t

xn/s

ec)

0K

8K

16K

24K

32K

Redis DiamondRead

Committed

DiamondStrict

Serializability

-2.1%

-48.5%

Weak Consistency

StrongConsistency Linearizable

Transactions

24

Page 81: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

What does Diamond provide for reactive apps?

Automated end-to-end data management and storage. What does Diamond guarantee for reactive apps?

Strong ACID+R transactional guarantees. How does Diamond impact app complexity and performance?

Simplifies reactive apps with low overhead.

Summary

https://github.com/UWSysLab/diamond

25

Page 82: Diamond: Automating Data Management and Storage for Wide ... · Diamond: Automating Data Management and Storage for Wide-area, Reactive Applications Irene Zhang Niel Lebeck Pedro

Related Work

• Distributed Programming FrameworksMeteor, Parse, Firebase, Mjolnir, Mapjax, RethinkDB

• Client-side Programming FrameworksReact, Angular, Blaze, ReactiveX

• Distributed Storage SystemsRedis, MongoDB, Dropbox

• Notification/Pub-Sub/Streaming ServicesThialfi, Apache Kafka, Amazon Kinesis