Noria Dynamic, partially-stateful data-flow for high-performance - - PowerPoint PPT Presentation

noria
SMART_READER_LITE
LIVE PREVIEW

Noria Dynamic, partially-stateful data-flow for high-performance - - PowerPoint PPT Presentation

Noria Dynamic, partially-stateful data-flow for high-performance Web applications Jon Gjengset Malte Schwarzkopf Jonathan Behrens Lara Timb Arajo Martin Ek Eddie Kohler M. Frans Kaashoek Robert Morris 2 Frontend 2


slide-1
SLIDE 1

Dynamic, partially-stateful data-flow for
 high-performance Web applications

Jon Gjengset Jonathan Behrens Lara Timbó Araújo Martin Ek Eddie Kohler

  • M. Frans Kaashoek

Robert Morris Malte Schwarzkopf

Noria

slide-2
SLIDE 2

2

slide-3
SLIDE 3

Frontend

2

slide-4
SLIDE 4

🌏

Frontend

2

slide-5
SLIDE 5

Backend

🌏

Frontend

2

slide-6
SLIDE 6

Backend Frontend

3

slide-7
SLIDE 7

Backend Frontend

3

Stories Votes

slide-8
SLIDE 8

Backend Frontend

4

Stories Votes

JOIN COUNT FILTER

Query

slide-9
SLIDE 9

Backend Frontend

4

Stories Votes

JOIN COUNT FILTER

Query

slide-10
SLIDE 10

Backend Frontend

4

Stories Votes

90% reads

10% writes

JOIN COUNT FILTER

Query

slide-11
SLIDE 11

Backend Frontend

4

Stories Votes

Slow reads, repeated work!

90% reads

10% writes

JOIN COUNT FILTER

Query

slide-12
SLIDE 12

Frontend

5

Stories Votes

Precomputed results

2 2

JOIN COUNT FILTER

Query

slide-13
SLIDE 13

Frontend

5

Stories Votes

Precomputed results

2 2

READ

JOIN COUNT FILTER

Query

slide-14
SLIDE 14

Frontend

5

Stories Votes

Precomputed results

2 2

READ

JOIN COUNT FILTER

Query

Store in base table?
 — manual, slow.

slide-15
SLIDE 15

Frontend

5

Stories Votes

Precomputed results

2 2

READ

JOIN COUNT FILTER

Query

Store in base table?
 — manual, slow. memcached?
 — complex 
 [Facebook NSDI’13].

slide-16
SLIDE 16

Frontend

5

Stories Votes

JOIN COUNT FILTER

2 2

Streaming
 data-flow?

Store in base table?
 — manual, slow. memcached?
 — complex 
 [Facebook NSDI’13].

slide-17
SLIDE 17

Frontend

6

Stories Votes

JOIN COUNT FILTER

2 2

Streaming
 data-flow?

INSERT

slide-18
SLIDE 18

Frontend

6

Stories Votes

JOIN COUNT FILTER

2 2

Streaming
 data-flow?

3

slide-19
SLIDE 19

Frontend

6

Stories Votes

JOIN COUNT FILTER

Materialized
 view

2 2

Streaming
 data-flow?

3

slide-20
SLIDE 20

Frontend

6

Stories Votes

JOIN COUNT FILTER

Materialized
 view

2 2

Fast reads. Efficient writes. Parallelizes well.

Streaming
 data-flow?

3

slide-21
SLIDE 21

Frontend

7

Stories Votes

Challenges

JOIN COUNT FILTER

2 3 1 3 2

slide-22
SLIDE 22

Frontend

7

Stories Votes

  • Change queries? Restart!

Challenges

State-of-the-art
 data-flow systems:

JOIN COUNT FILTER

2 3 1 3 2

slide-23
SLIDE 23

Frontend

7

Stories Votes

  • Change queries? Restart!

Challenges

State-of-the-art
 data-flow systems:

JOIN COUNT FILTER SUM

4 2

 

4 2

 

2 3 2 3 1

slide-24
SLIDE 24

Frontend

7

Stories Votes

  • Change queries? Restart!
  • Memory footprint? Grows!

Challenges

State-of-the-art
 data-flow systems:

JOIN COUNT FILTER SUM

4 2

 

4 2

 

2 3 2 3 1

slide-25
SLIDE 25

Frontend

8

Stories Votes

Noria

slide-26
SLIDE 26

Frontend

8

Stories Votes

JOIN COUNT FILTER

3 2

Noria

3 2 1

slide-27
SLIDE 27

Frontend

8

Stories Votes

JOIN COUNT FILTER

3 2

  • Change queries? Live.

Noria

3 2 1

slide-28
SLIDE 28

Frontend

8

Stories Votes

JOIN COUNT FILTER

3 2

  • Change queries? Live.

Noria

4 2

 

4 2

 

SUM

3 2 1

slide-29
SLIDE 29

Frontend

8

Stories Votes

JOIN COUNT FILTER

3 2

  • Change queries? Live.
  • Memory footprint? Bounded.

Noria

4 2

 

4 2

 

SUM

3 2 1

slide-30
SLIDE 30

Frontend

8

Stories Votes

JOIN COUNT FILTER

3

  • Change queries? Live.
  • Memory footprint? Bounded.

Noria

4 2

 

4 2

 

SUM

3

slide-31
SLIDE 31

Frontend

8

Stories Votes

JOIN COUNT FILTER

3

  • Change queries? Live.
  • Memory footprint? Bounded.
  • No global coordination.

Noria

4 2

 

4 2

 

SUM

3

slide-32
SLIDE 32

New model:


Partially-stateful data-flow

9

slide-33
SLIDE 33

10

Stories Votes

JOIN COUNT FILTER

3 1 3 2 2

Partially-stateful
 data-flow

Data-flow state is partial: entries for some keys are absent ( ).

Frontend

slide-34
SLIDE 34

10

Stories Votes

JOIN COUNT FILTER

3 1 3 2

Partially-stateful
 data-flow

Data-flow state is partial: entries for some keys are absent ( ).

Frontend

slide-35
SLIDE 35

10

Stories Votes

JOIN COUNT FILTER

3 3 2

Partially-stateful
 data-flow

Data-flow state is partial: entries for some keys are absent ( ).

Frontend

slide-36
SLIDE 36

10

Stories Votes

JOIN COUNT FILTER

3 3 2

Partially-stateful
 data-flow

Data-flow state is partial: entries for some keys are absent ( ).

Lower memory footprint.

Frontend

slide-37
SLIDE 37

10

Stories Votes

JOIN COUNT FILTER

3 3 2

Partially-stateful
 data-flow

Data-flow state is partial: entries for some keys are absent ( ).

Lower memory footprint. No need to update absent entries.

Frontend

slide-38
SLIDE 38

10

Stories Votes

JOIN COUNT FILTER

3 3 2

Partially-stateful
 data-flow

Data-flow state is partial: entries for some keys are absent ( ).

Lower memory footprint. No need to update absent entries. Enables live data-flow changes.

Frontend

slide-39
SLIDE 39

11

Stories Votes

JOIN COUNT FILTER

3 3 2

Partially-stateful
 data-flow: upqueries

READ

Frontend

slide-40
SLIDE 40

11

Stories Votes

JOIN COUNT FILTER

3 3 2

Partially-stateful
 data-flow: upqueries

??? Need to fill absent entry!

READ

Frontend

slide-41
SLIDE 41

11

Stories Votes

JOIN COUNT FILTER

3 3 2

Partially-stateful
 data-flow: upqueries

??? Need to fill absent entry!

READ

Solution: upquery through data-flow.

  • Compute missing entry from


upstream state

Frontend

slide-42
SLIDE 42

Frontend

12

Stories Votes

JOIN COUNT FILTER

3 3 2

Partially-stateful
 data-flow: upqueries

Solution: upquery through data-flow.

  • Compute missing entry from


upstream state

  • Response fills missing entry

READ

slide-43
SLIDE 43

Frontend

12

Stories Votes

JOIN COUNT FILTER

3 3 2

Partially-stateful
 data-flow: upqueries

Solution: upquery through data-flow.

  • Compute missing entry from


upstream state

  • Response fills missing entry

2

READ

slide-44
SLIDE 44

13

Start new views and operator state empty, fill via upqueries.

Partial state enables live data-flow changes

Stories Votes

JOIN COUNT FILTER

3 2 3 2 1

Frontend

slide-45
SLIDE 45

13

 

SUM

 

Start new views and operator state empty, fill via upqueries.

Partial state enables live data-flow changes

Stories Votes

JOIN COUNT FILTER

3 2 3 2 1

Frontend

slide-46
SLIDE 46

13

 

SUM

 

Start new views and operator state empty, fill via upqueries.

Partial state enables live data-flow changes

Stories Votes

JOIN COUNT FILTER

3 2 3 2 1

Frontend

READ 

slide-47
SLIDE 47

13

 

SUM

 

Start new views and operator state empty, fill via upqueries.

Partial state enables live data-flow changes

Stories Votes

JOIN COUNT FILTER

3 2 3 2 1

Frontend

READ 

slide-48
SLIDE 48

13

 

SUM

 

Start new views and operator state empty, fill via upqueries.

4 4

Partial state enables live data-flow changes

Stories Votes

JOIN COUNT FILTER

3 2 3 2 1

Frontend

READ 

slide-49
SLIDE 49

14

 

SUM

 

4 4

Stories Votes

JOIN COUNT FILTER

3 2 3 2 1

Frontend

High performance requires concurrency

slide-50
SLIDE 50

14

 

SUM

 

4 4

Stories Votes

JOIN COUNT FILTER

3 2 3 2 1

Frontend

High performance requires concurrency

Process operators concurrently. Read from views concurrently. Process shards concurrently. Without global coordination!

slide-51
SLIDE 51

14

 

SUM

 

4 4

Stories Votes

JOIN COUNT FILTER

3 2 3 2 1

Frontend

High performance requires concurrency

Process operators concurrently. Read from views concurrently. Process shards concurrently. Without global coordination!

slide-52
SLIDE 52

14

 

SUM

 

4 4

Stories Votes

JOIN COUNT FILTER

3 2 3 2 1

Frontend

High performance requires concurrency

Process operators concurrently. Read from views concurrently. Process shards concurrently. Without global coordination!

slide-53
SLIDE 53

Challenges implementing partially-stateful data-flow

15

slide-54
SLIDE 54

Challenges implementing partially-stateful data-flow

15

  • 1. Concurrent upqueries and forward processing — races!

Must maintain correctness under concurrency!

slide-55
SLIDE 55

Challenges implementing partially-stateful data-flow

15

  • 1. Concurrent upqueries and forward processing — races!

Must maintain correctness under concurrency!

slide-56
SLIDE 56

Correctness under concurrency

16

Goal: upquery restores state as if present all along.

slide-57
SLIDE 57

Correctness under concurrency

16

Goal: upquery restores state as if present all along.

COUNT

2

slide-58
SLIDE 58

Correctness under concurrency

16

Goal: upquery restores state as if present all along.

1 2

COUNT

2

slide-59
SLIDE 59

Correctness under concurrency

16

Goal: upquery restores state as if present all along.

1 2

COUNT

2

slide-60
SLIDE 60

Correctness under concurrency

16

Goal: upquery restores state as if present all along.

1 2

COUNT

2

slide-61
SLIDE 61

Correctness under concurrency

16

Goal: upquery restores state as if present all along.

1 2 Upquery response is a snapshot of state

COUNT

2

2

slide-62
SLIDE 62

Correctness under concurrency

16

Goal: upquery restores state as if present all along.

1 2 Upquery response is a snapshot of state

COUNT

2

2 includes 1 2 does not include 3

3

slide-63
SLIDE 63

Correctness under concurrency

16

Goal: upquery restores state as if present all along.

1 2 Upquery response is a snapshot of state

COUNT

2

2 includes 1 2 does not include

Solution: Maintain order of upquery response and surrounding
 updates, despite lack of global coordination.

3

3

slide-64
SLIDE 64

Upquery responses in total order with updates

17

Goal: upquery restores state as if present all along.

slide-65
SLIDE 65

Upquery responses in total order with updates

17

Goal: upquery restores state as if present all along.

2

2

3 3 1

resulting state respects total order

slide-66
SLIDE 66

Upquery responses in total order with updates

17

Goal: upquery restores state as if present all along.

2

2

3 3 1

resulting state respects total order

2

3 2 2 1

resulting state violates total order

slide-67
SLIDE 67

Upquery responses in total order with updates

17

Goal: upquery restores state as if present all along.

2

2

3 3 1

resulting state respects total order

2

3 2 2 1

resulting state violates total order

More complex cases: merged upquery responses, evictions (Paper).

slide-68
SLIDE 68

Challenges implementing partially-stateful data-flow

18

  • 1. Concurrent upqueries and forward processing — races!
  • 2. Update processing may require absent state

Must maintain correctness under concurrency!

slide-69
SLIDE 69

Challenges implementing partially-stateful data-flow

18

  • 1. Concurrent upqueries and forward processing — races!
  • 2. Update processing may require absent state

COUNT

3 2

… absent

Must maintain correctness under concurrency!

slide-70
SLIDE 70

Challenges implementing partially-stateful data-flow

18

  • 1. Concurrent upqueries and forward processing — races!
  • 2. Update processing may require absent state

COUNT

3 2

… absent

Must maintain correctness under concurrency! Drop updates that touch absent state, future upquery repeats them.

slide-71
SLIDE 71

Challenges implementing partially-stateful data-flow

18

  • 1. Concurrent upqueries and forward processing — races!
  • 2. Update processing may require absent state

COUNT

3 2

… absent

Must maintain correctness under concurrency! Drop updates that touch absent state, future upquery repeats them.

(see Paper)

slide-72
SLIDE 72

19

Noria implementation

slide-73
SLIDE 73

19

Noria implementation

slide-74
SLIDE 74

19

Noria implementation

MySQL adapter

slide-75
SLIDE 75

19

Noria implementation

Data-flow graph MySQL adapter

Transform

slide-76
SLIDE 76

19

Noria implementation

Data-flow graph MySQL adapter

Transform

slide-77
SLIDE 77

19

Noria implementation

Data-flow graph MySQL adapter

  • 45k lines of Rust + 15k libraries
  • RocksDB for base table storage
  • ZooKeeper for leader election

Transform

slide-78
SLIDE 78
  • 1. Can Noria improve a real web application’s performance?
  • 2. How does Noria compare to alternative approaches?
  • 3. Can Noria change queries without downtime?

20

Evaluation

slide-79
SLIDE 79
  • 1. Can Noria improve a real web application’s performance?
  • 2. How does Noria compare to alternative approaches?
  • 3. Can Noria change queries without downtime?

20

Evaluation

Amazon EC2 c5.4xlarge instance (16 vCPUs) Open-loop clients, measuring latency & throughput Setup

slide-80
SLIDE 80
  • 1. Can Noria improve a real web application’s performance?
  • 2. How does Noria compare to alternative approaches?
  • 3. Can Noria change queries without downtime?

20

Evaluation

Amazon EC2 c5.4xlarge instance (16 vCPUs) Open-loop clients, measuring latency & throughput Setup

multi-machine experiments
 comparison with differential dataflow} see Paper

slide-81
SLIDE 81

21

Case study: Lobsters (http://lobste.rs)

slide-82
SLIDE 82

21

Case study: Lobsters (http://lobste.rs)

  • Ruby-on-Rails application


with MySQL backend

slide-83
SLIDE 83

21

Case study: Lobsters (http://lobste.rs)

  • Ruby-on-Rails application


with MySQL backend

  • Hand-optimized by

developers to pre-compute aggregations

slide-84
SLIDE 84

21

Case study: Lobsters (http://lobste.rs)

  • Ruby-on-Rails application


with MySQL backend

  • Hand-optimized by

developers to pre-compute aggregations

  • Noria data-flow with


235 operators, 35 views

slide-85
SLIDE 85

21

Case study: Lobsters (http://lobste.rs)

  • Ruby-on-Rails application


with MySQL backend

  • Hand-optimized by

developers to pre-compute aggregations

  • Noria data-flow with


235 operators, 35 views

  • Emulate production load
slide-86
SLIDE 86

22

Can Noria improve Lobsters’ performance?

slide-87
SLIDE 87

22

Can Noria improve Lobsters’ performance?

Better Better

slide-88
SLIDE 88

22

Can Noria improve Lobsters’ performance?

Better Better

slide-89
SLIDE 89

22

Can Noria improve Lobsters’ performance?

Better Better

slide-90
SLIDE 90

22

Noria with natural queries supports 5x MySQL’s throughput.

Can Noria improve Lobsters’ performance?

Better Better

slide-91
SLIDE 91

23

How does Noria compare to alternatives?

Better Better

slide-92
SLIDE 92

23

How does Noria compare to alternatives?

  • Zipf-distributed story ID,


95% reads, 5% writes

  • No TX, all in-memory

Better Better

slide-93
SLIDE 93

23

How does Noria compare to alternatives?

  • Zipf-distributed story ID,


95% reads, 5% writes

  • No TX, all in-memory

Better Better

slide-94
SLIDE 94

24

How does Noria compare to alternatives?

Better Better

  • Zipf-distributed story ID,


95% reads, 5% writes

  • No TX, all in-memory
slide-95
SLIDE 95

24

How does Noria compare to alternatives?

Better Better

  • Zipf-distributed story ID,


95% reads, 5% writes

  • No TX, all in-memory
slide-96
SLIDE 96

24

How does Noria compare to alternatives?

Noria outperforms an in-memory key- value store and simplifies its interface.

Better Better

  • Zipf-distributed story ID,


95% reads, 5% writes

  • No TX, all in-memory
slide-97
SLIDE 97

3 2

25

Can Noria change queries without downtime?

JOIN COUNT FILTER

Stories Votes

slide-98
SLIDE 98

3 2

25

Can Noria change queries without downtime?

JOIN COUNT FILTER

Stories Votes

3 ⭐ 1.5 ⭐

AVG JOIN

COUNT

Ratings

⭐⭐⭐ ⭐ ⭐⭐

slide-99
SLIDE 99

26

Can Noria change queries without downtime?

Better

slide-100
SLIDE 100

26

Can Noria change queries without downtime?

new table & query added

Better

slide-101
SLIDE 101

26

Can Noria change queries without downtime?

new table & query added

Better

slide-102
SLIDE 102

26

Can Noria change queries without downtime?

new table & query added

Better

  • Zipf-distributed story ID, 95% reads;

2M existing votes at transition

slide-103
SLIDE 103

27

Can Noria change queries without downtime?

Better

  • Zipf-distributed story ID, 95% reads;

2M existing votes at transition

  • Old view reads are live throughout
slide-104
SLIDE 104

27

Can Noria change queries without downtime?

instantaneous transition,
 no downtime for writes

Better

  • Zipf-distributed story ID, 95% reads;

2M existing votes at transition

  • Old view reads are live throughout
slide-105
SLIDE 105

27

Can Noria change queries without downtime?

instantaneous transition,
 no downtime for writes 80% of reads from new view proceed
 without upquery after 1 second

Better

  • Zipf-distributed story ID, 95% reads;

2M existing votes at transition

  • Old view reads are live throughout
slide-106
SLIDE 106

27

Can Noria change queries without downtime?

instantaneous transition,
 no downtime for writes 80% of reads from new view proceed
 without upquery after 1 second

Noria achieves downtime-free query change with partial state.

Better

  • Zipf-distributed story ID, 95% reads;

2M existing votes at transition

  • Old view reads are live throughout
slide-107
SLIDE 107
  • New partially-stateful data-flow model.
  • Noria: new web application backend based on data-flow.
  • Partial state saves space and allows live change.
  • Supports high throughput on one or more machines.
  • Open source, try it out!

28

Noria — Summary

slide-108
SLIDE 108
  • New partially-stateful data-flow model.
  • Noria: new web application backend based on data-flow.
  • Partial state saves space and allows live change.
  • Supports high throughput on one or more machines.
  • Open source, try it out!

28

https://pdos.csail.mit.edu/noria

Noria — Summary

(see our demo at poster #37 today!)