108
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

Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Dynamic, partially-stateful data-flow forhigh-performance Web applications

Jon Gjengset

Jonathan Behrens Lara Timbó Araújo Martin Ek

Eddie Kohler M. Frans Kaashoek Robert Morris

Malte Schwarzkopf

Noria

Page 2: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!2

Page 3: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend!2

Page 4: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

🌎 Frontend!2

Page 5: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Backend

🌎 Frontend!2

Page 6: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Backend

Frontend

!3

Page 7: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Backend

Frontend

!3

Stories Votes

Page 8: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Backend

Frontend

!4

Stories Votes

JOIN

COUNT

FILTERQuery

Page 9: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Backend

Frontend

!4

Stories Votes

JOIN

COUNT

FILTERQuery

Page 10: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Backend

Frontend

!4

Stories Votes

90% reads10% writes

JOIN

COUNT

FILTERQuery

Page 11: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Backend

Frontend

!4

Stories Votes

Slow reads, repeated work!

☹90% reads

10% writesJOIN

COUNT

FILTERQuery

Page 12: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!5

Stories Votes

Precomputed results

22

JOIN

COUNT

FILTERQuery

Page 13: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!5

Stories Votes

Precomputed results

22

READ

JOIN

COUNT

FILTERQuery

Page 14: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!5

Stories Votes

Precomputed results

22

READ

JOIN

COUNT

FILTERQuery

Store in base table?— manual, slow.

Page 15: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!5

Stories Votes

Precomputed results

22

READ

JOIN

COUNT

FILTERQuery

Store in base table?— manual, slow.

memcached?— complex [Facebook NSDI’13].

Page 16: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!5

Stories Votes

JOIN

COUNT

FILTER

22

Streamingdata-flow?

Store in base table?— manual, slow.

memcached?— complex [Facebook NSDI’13].

Page 17: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!6

Stories Votes

JOIN

COUNT

FILTER

22

Streamingdata-flow?

INSERT

Page 18: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!6

Stories Votes

JOIN

COUNT

FILTER

22

Streamingdata-flow?

3

Page 19: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!6

Stories Votes

JOIN

COUNT

FILTER

Materializedview

22

Streamingdata-flow?

3

Page 20: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!6

Stories Votes

JOIN

COUNT

FILTER

Materializedview

22

Fast reads. Efficient writes. Parallelizes well.

Streamingdata-flow?

3

Page 21: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!7

Stories VotesChallenges

JOIN

COUNT

FILTER

23

13

2

Page 22: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!7

Stories Votes

‣Change queries? Restart!

ChallengesState-of-the-artdata-flow systems:

JOIN

COUNT

FILTER

23

13

2

Page 23: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!7

Stories Votes

‣Change queries? Restart!

ChallengesState-of-the-artdata-flow systems:

JOIN

COUNT

FILTERSUM 4

2#

$

42

#

$

23

2

31

Page 24: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!7

Stories Votes

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

ChallengesState-of-the-artdata-flow systems:

JOIN

COUNT

FILTERSUM 4

2#

$

42

#

$

23

2

31

Page 25: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!8

Stories VotesNoria

Page 26: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!8

Stories Votes

JOIN

COUNT

FILTER

32

Noria

3

21

Page 27: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!8

Stories Votes

JOIN

COUNT

FILTER

32

‣Change queries? Live.

Noria

3

21

Page 28: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!8

Stories Votes

JOIN

COUNT

FILTER

32

‣Change queries? Live.

Noria

42

#

$

42

#

$

SUM

3

21

Page 29: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!8

Stories Votes

JOIN

COUNT

FILTER

32

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

Noria

42

#

$

42

#

$

SUM

3

21

Page 30: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!8

Stories Votes

JOIN

COUNT

FILTER

3

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

Noria

42

#

$

42

#

$

SUM

3

Page 31: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Frontend

!8

Stories Votes

JOIN

COUNT

FILTER

3

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

Noria

42

#

$

42

#

$

SUM

3

Page 32: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

New model: Partially-stateful data-flow

!9

Page 33: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!10

Stories Votes

JOIN

COUNT

FILTER

3

13

2

2

Partially-stateful data-flow

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

Frontend

Page 34: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!10

Stories Votes

JOIN

COUNT

FILTER

3

13

2

Partially-stateful data-flow

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

Frontend

Page 35: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!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

Page 36: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!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

Page 37: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!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

Page 38: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!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

Page 39: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!11

Stories Votes

JOIN

COUNT

FILTER

3

3

2

Partially-stateful data-flow: upqueries

READ

Frontend

Page 40: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!11

Stories Votes

JOIN

COUNT

FILTER

3

3

2

Partially-stateful data-flow: upqueries

??? Need to fill absent entry!READ

Frontend

Page 41: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!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

Page 42: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

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

Page 43: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

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

Page 44: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!13

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

Partial state enables live data-flow changes

Stories Votes

JOIN

COUNT

FILTER

32

3

21

Frontend

Page 45: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!13

#

$

SUM

#

$

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

Partial state enables live data-flow changes

Stories Votes

JOIN

COUNT

FILTER

32

3

21

Frontend

Page 46: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!13

#

$

SUM

#

$

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

Partial state enables live data-flow changes

Stories Votes

JOIN

COUNT

FILTER

32

3

21

Frontend

READ #

Page 47: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!13

#

$

SUM

#

$

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

Partial state enables live data-flow changes

Stories Votes

JOIN

COUNT

FILTER

32

3

21

Frontend

READ #

Page 48: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!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

32

3

21

Frontend

READ #

Page 49: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!14

#

$

SUM

#

$

4

4

Stories Votes

JOIN

COUNT

FILTER

32

3

21

Frontend

High performance requires concurrency

Page 50: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!14

#

$

SUM

#

$

4

4

Stories Votes

JOIN

COUNT

FILTER

32

3

21

Frontend

High performance requires concurrency

Process operators concurrently.Read from views concurrently.Process shards concurrently.

Without global coordination!

Page 51: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!14

#

$

SUM

#

$

4

4

Stories Votes

JOIN

COUNT

FILTER

32

3

21

Frontend

High performance requires concurrency

Process operators concurrently.Read from views concurrently.Process shards concurrently.

Without global coordination!

Page 52: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!14

#

$

SUM

#

$

4

4

Stories Votes

JOIN

COUNT

FILTER

32

3

21

Frontend

High performance requires concurrency

Process operators concurrently.Read from views concurrently.Process shards concurrently.

Without global coordination!

Page 53: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Challenges implementing partially-stateful data-flow

!15

Page 54: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Challenges implementing partially-stateful data-flow

!15

1. Concurrent upqueries and forward processing — races!

Must maintain correctness under concurrency!

Page 55: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Challenges implementing partially-stateful data-flow

!15

1. Concurrent upqueries and forward processing — races!

Must maintain correctness under concurrency!

Page 56: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Correctness under concurrency

!16

Goal: upquery restores state as if present all along.

Page 57: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Correctness under concurrency

!16

Goal: upquery restores state as if present all along.

COUNT2

Page 58: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Correctness under concurrency

!16

Goal: upquery restores state as if present all along.

12

COUNT2

Page 59: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Correctness under concurrency

!16

Goal: upquery restores state as if present all along.

12

COUNT2

Page 60: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Correctness under concurrency

!16

Goal: upquery restores state as if present all along.

12

COUNT2

Page 61: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Correctness under concurrency

!16

Goal: upquery restores state as if present all along.

12

Upquery response is a snapshot of state

COUNT2

2

Page 62: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Correctness under concurrency

!16

Goal: upquery restores state as if present all along.

12

Upquery response is a snapshot of state

COUNT2

2

includes 12

does not include33

Page 63: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Correctness under concurrency

!16

Goal: upquery restores state as if present all along.

12

Upquery response is a snapshot of state

COUNT2

2

includes 12

does not include

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

33

Page 64: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Upquery responses in total order with updates

!17

Goal: upquery restores state as if present all along.

Page 65: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Upquery responses in total order with updates

!17

Goal: upquery restores state as if present all along.

223

3

1

resulting staterespects total order

Page 66: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Upquery responses in total order with updates

!17

Goal: upquery restores state as if present all along.

223

3

1

resulting staterespects total order

232

2

1

resulting stateviolates total order

Page 67: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

Upquery responses in total order with updates

!17

Goal: upquery restores state as if present all along.

223

3

1

resulting staterespects total order

232

2

1

resulting stateviolates total order

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

Page 68: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

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!

Page 69: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

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!

Page 70: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

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.

Page 71: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

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)

Page 72: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!19

Noria implementation

Page 73: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!19

Noria implementation

Page 74: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!19

Noria implementation

MySQL adapter

Page 75: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!19

Noria implementation

Data-flow graph

MySQL adapter

Transform

Page 76: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!19

Noria implementation

Data-flow graph

MySQL adapter

Transform

Page 77: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!19

Noria implementation

Data-flow graph

MySQL adapter

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

Transform

Page 78: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

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

Page 79: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

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

Page 80: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

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 experimentscomparison with differential dataflow } see Paper

Page 81: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!21

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

Page 82: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!21

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

‣Ruby-on-Rails applicationwith MySQL backend

Page 83: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!21

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

‣Ruby-on-Rails applicationwith MySQL backend‣Hand-optimized by

developers to pre-compute aggregations

Page 84: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!21

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

‣Ruby-on-Rails applicationwith MySQL backend‣Hand-optimized by

developers to pre-compute aggregations‣Noria data-flow with

235 operators, 35 views

Page 85: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!21

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

‣Ruby-on-Rails applicationwith MySQL backend‣Hand-optimized by

developers to pre-compute aggregations‣Noria data-flow with

235 operators, 35 views‣Emulate production load

Page 86: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!22

Can Noria improve Lobsters’ performance?

Page 87: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!22

Can Noria improve Lobsters’ performance?Be

tter

Better

Page 88: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!22

Can Noria improve Lobsters’ performance?Be

tter

Better

Page 89: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!22

Can Noria improve Lobsters’ performance?Be

tter

Better

Page 90: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!22

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

Can Noria improve Lobsters’ performance?Be

tter

Better

Page 91: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!23

How does Noria compare to alternatives?Be

tter

Better

Page 92: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!23

How does Noria compare to alternatives?

‣Zipf-distributed story ID,95% reads, 5% writes ‣No TX, all in-memory

Bette

r

Better

Page 93: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!23

How does Noria compare to alternatives?

‣Zipf-distributed story ID,95% reads, 5% writes ‣No TX, all in-memory

Bette

r

Better

Page 94: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!24

How does Noria compare to alternatives?Be

tter

Better

‣Zipf-distributed story ID,95% reads, 5% writes ‣No TX, all in-memory

Page 95: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!24

How does Noria compare to alternatives?Be

tter

Better

‣Zipf-distributed story ID,95% reads, 5% writes ‣No TX, all in-memory

Page 96: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!24

How does Noria compare to alternatives?

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

Bette

r

Better

‣Zipf-distributed story ID,95% reads, 5% writes ‣No TX, all in-memory

Page 97: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

32

!25

Can Noria change queries without downtime?

JOIN

COUNT

FILTER

StoriesVotes

Page 98: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

32

!25

Can Noria change queries without downtime?

JOIN

COUNT

FILTER

StoriesVotes

3 ⭐

1.5 ⭐

AVG

JOIN

COUNT

Ratings⭐⭐⭐

⭐⭐

Page 99: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!26

Can Noria change queries without downtime?Be

tter

Page 100: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!26

Can Noria change queries without downtime?

new table & query added

Bette

r

Page 101: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!26

Can Noria change queries without downtime?

new table & query added

Bette

r

Page 102: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!26

Can Noria change queries without downtime?

new table & query added

Bette

r

‣Zipf-distributed story ID, 95% reads; 2M existing votes at transition

Page 103: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!27

Can Noria change queries without downtime?Be

tter

‣Zipf-distributed story ID, 95% reads; 2M existing votes at transition‣Old view reads are live throughout

Page 104: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!27

Can Noria change queries without downtime?

instantaneous transition,no downtime for writes

Bette

r

‣Zipf-distributed story ID, 95% reads; 2M existing votes at transition‣Old view reads are live throughout

Page 105: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!27

Can Noria change queries without downtime?

instantaneous transition,no downtime for writes

80% of reads from new view proceedwithout upquery after 1 second

Bette

r

‣Zipf-distributed story ID, 95% reads; 2M existing votes at transition‣Old view reads are live throughout

Page 106: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

!27

Can Noria change queries without downtime?

instantaneous transition,no downtime for writes

80% of reads from new view proceedwithout upquery after 1 second

Noria achieves downtime-free query change with partial state.

Bette

r

‣Zipf-distributed story ID, 95% reads; 2M existing votes at transition‣Old view reads are live throughout

Page 107: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

• 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

Page 108: Noria - USENIX...Frontend!4 Stories Votes 90% reads 10% writes JOIN COUNT FILTER Query. Backend Frontend!4 Stories Votes Slow reads, repeated work! ... upstream state Frontend. Frontend!12

• 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!)