Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup...

34
Yunhao Zhang, Rong Chen, Haibo Chen Institute of Parallel and Distributed Systems (IPADS) Shanghai Jiao Tong University Sub-millisecond Stateful Stream Querying over Fast-evolving Linked Data

Transcript of Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup...

Page 1: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

Yunhao Zhang, Rong Chen, Haibo Chen

Institute of Parallel and Distributed Systems (IPADS)Shanghai Jiao Tong University

Sub-millisecondStatefulStreamQueryingoverFast-evolvingLinkedData

Page 2: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

Stream Query is Important

2

Multiple data sources are continuously generating streaming data in high velocity

Page 3: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

Stateful Stream Query

A stateful stream query needs to integrate streaming data with stored data

Real-timeUser Activity

DurableSocial Graph

3

Page 4: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

Stateful Stream Query

A stateful stream query needs to integrate streaming data with stored data

Real-timeUser Activity

DurableSocial Graph

Streaming Data: high velocity

Stored Data: large & evolving

4

Page 5: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

5

Example Dataset for Stateful Stream Query

IPADS

System@Cornell

Stored DataStreaming Data

<Rong, creates, Feed>. 12:30<Feed, hash_tag, SOSP>. 12:30<Yunhao, likes, Feed>. 12:31<Haibo, likes, Feed>. 12:40

Page 6: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

6

Connectivity Property of Data

Streaming Data

Feed 12:30

Like12:31

12:40

Rong

Feed

#SOSP#

Yunhao

Haibo

Linked data represents information as entitiesand relations between the entities

Stored Data

Haibo

IPADS

Rong

Yunhaomember_of

Cornell

Page 7: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

7

Example Continuous Query

In the last 30 minutes, which IPADS members created feeds that are liked by other IPADS members?

?Y

IPADS

?X

?Feed

timeRegisteredbyuser

TriggeredbysystemTriggeredbysystem

TriggeredbysystemCanceledbyuser

Page 8: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

8

Example Continuous Query

Feed 12:30

Like

12:40

Rong

Feed

Haibo

Streaming Data

Yunhao12:31

Stored Data

Rong

Haibo

IPADS

Rong

Feed

Haibo

In the last 30 minutes, which IPADS members created feeds that are liked by other IPADS members?

Page 9: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

Workload Characteristics

Connectivityproperty

Stateful queries integrate Storedand Streaming

Data

Stored dataevolves by absorbing

streaming data

9

Page 10: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

10

Conventional Approach

StreamingData

StoredData

StreamProcessingSystem

GraphStoreSystem

ContinuousQuery

One-shotQuery

Page 11: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

11

Composite Design

Apache Storm

WukongOSDI’16

StreamProcessingSystem

GraphStoreSystem

Composite Design Example

Page 12: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

12

Composite Design Observations1. Cross-system Cost

~40% execution time wasted due to data transformation and transmission

2. Inefficient Query PlanSemantic gap between the two systems impair query optimization

3. Limited ScalabilityStream processing systems dedicate all resources to the improve performance ofa single job

Page 13: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

13

Composite Design Observations1. Cross-system Cost

~40% execution time wasted due to data transformation and transmission

2. Inefficient Query PlanSemantic gap between the two systems impair query optimization

3. Limited ScalabilityStream processing systems dedicate all resources to the improve performance ofa single job

Composite Design: high latency

low throughput

Page 14: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

14

Design Overview

Wukong+S uses a novel integrated design for stateful stream query over fast-evolving linked data

Integrated Design manages streaming data and stored data in a single system

► Eliminate cross-system cost► Global semantics for query optimization► Better scalability by sharing data between the queries

Page 15: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

15

Design Outline

Implementing integrated design is not trivial

Decisions for efficient integrated design:► Hybrid Store: efficiently handle streaming data and fast-

evolving stored data► Stream Index: fast path to access streaming data in a

certain time interval► Consistent Data View: through decentralized vector

timestamps and bounded snapshot scalarization

Page 16: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

16

Wukong+S Architecture

Data is partitioned and stored on multiple servers

ContinuousQuery

One-shotQuery

Engine

Store

Engine

Store

Engine

Store

Serve queries

Hold data partition

Page 17: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

17

Hybrid Store

How to gracefully integrate streaming data and stored data?

Strawman: using different graph stores according to “where from”, namely streaming and stored data

Hybrid Store: using different graph stores according to “how to use”, namely timeless and timed data

Page 18: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

18

Explicit Separation of Streaming DataStreamingData

StoredData

user-definedpredicate

Timed

One-shotQuery

TimelessContinuous

Query

Page 19: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

19

Benefit of Hybrid Store

No interference between timeless data and timed data

Design data stores separately and optimize for different operation pattern:

► Timeless Data: continuous persistent store► Timed Data: time-based transient store

Page 20: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

20

Hybrid StoreContinuous Persistent Store ► Continuously absorb the timeless portion of streams ► Goal: support stateful continuous query and up-to-

date one-shot query

TimedData

Page 21: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

21

Hybrid StoreTime-based Transient Store ► Timed data will only be accessed by relevant

continuous queries in a time interval► Goal: support fast garbage collection (GC) for the

timed portion of streams

TimedData

Page 22: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

22

How to provide consistent view over dynamic data with memory efficiency?

Consistent Data Snapshot

► Streaming data contains order information

► Early output from a stream source should always be visible before later output

► No order relation across data sources

Page 23: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

Decentralized Vector Timestamp (VTS)

Source0:

Source1:

Server0

Server1

11

11

12

12

Local_VTS

Local_VTS

Stable_VTS

Continuous Query

4

4 5

5

Data is partitioned and stored on multiple servers

8:00 8:01 8:02

4 5

11 12

Time

23

Page 24: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

24

One-shot Query

Key

Snapshot Scalarization

Server0

11 124

[4,10]

5

[4,11]

[4,12]

××

[5,12]√

2

3

Encoded in KeySN:SnapshotNumberVTS:VectorTimestamp

SN=2:[4,10]SN=3:[5,12]

SN-VTS PlanVisible

snapshotSN=4:[7,14]

Page 25: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

25

Benefit of Snapshot ScalarizationMemoryEfficiency

Staleness ofStoredData

InjectionSpeed

streamquery

scenario

boundnumber of

visible snapshot

decoupledata sources from

underlying store

controlstaleness bySN_VTS Plan

Page 26: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

26

► Stream index & locality-aware partitioning

► Data-driven query trigger

► One-shot query execution

► Fault tolerance

► Leveraging RDMA

Other Designs of Wukong+S

Page 27: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

27

EvaluationBaseline: 6 state-of-the-art systems□ CSPARQL-engine, Heron+Wukong, Storm+Wukong□ Spark Streaming, Spark Structured Streaming, Wukong/ext

Platforms: a rack-scale 8-machine cluster□ Each: two 12-core Intel Xeon, 128GB DRAM, w/ RDMA

Mellanox 56Gbps InfiniBand NIC, 40Gbps IB Switch

Benchmarks:□ LSBench: Social Networking Benchmark w/ 3.75B initial

stored data & 5 streams totally 134K tuple/second stream□ CityBench: Smart City Benchmark w/ 11 real-world data

streams

Page 28: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

28

Single Query LatencyOutperform: state-of-the-art systems□ Wukong+S: sub-millisecond□ 13.7X speedup vs. Storm+Wukong□ 3 orders of magnitude speedup vs. Spark Streaming

0

10

20

30

40

50

L1 L2 L3 L4 L5 L6Wukong+S Storm+Wukong SparkStreaming

219 527 712 346 2215 1422

late

ncy

(mse

c)

0.10 0.08 0.110.23 1.64 2.62

31.14

40.77

49.03

1.78 3.50 1.68

Page 29: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

29

Single Query LatencyUnavoidable reason for high latency□ Cross-system Cost for Storm+Wukong□ Joining large stored data (3.75B) for Spark Streaming

0

10

20

30

40

50

L1 L2 L3 L4 L5 L6Wukong+S Storm+Wukong SparkStreaming

219 527 712 346 2215 1422

late

ncy

(mse

c)

0.10 0.08 0.110.23 1.64 2.62

31.14

40.77

49.03

1.78 3.50 1.68

Page 30: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

30

Throughput of Mixed Workloads

□ Wukong+S: ~1M queries/second on 8 nodes□ Mixture of 3 queries: 1.08M queries/second□ Add complex queries: 802K queries/second

Mixture of LSBench 1-6

0

200

400

600

800

0 2 4 6 8#machine

0

200

400

600

800

1000

0 2 4 6 8

Mixture of LSBench 1-3#machine

thro

ughp

ut(k

iloqu

ery/

seco

nd)

thro

ughp

ut(k

iloqu

ery/

seco

nd)

Page 31: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

31

Other Evaluations

► Influence of different stream rate

► Data insertion latency

► Performance of one-shot queries

► Memory consumption

► Fault-tolerance overhead

Page 32: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

32

: A distributed stream querying engine adopting a novel integrated desgin for statefulstream queries over fast-evolving linked data

Wukong+S

Existingsystemscannotsatisfydemandsofstateful streamqueryoverfast-evolvinglinkeddata

Conclusion

http://ipads.se.sjtu.edu.cn/projects/wukong

Achieving sub-millisecond latency and throughputexceeding one million queries per second

Page 33: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

33

Questions

Thanks

Institute of Parallel and Distributed Systems

Wukong+Shttp://ipads.se.sjtu.edu.cn/projects/wukong

Page 34: Sub-millisecond Stateful Stream Querying over Fast-evolving …S... · 2017-11-08 · 13.7X speedup vs. Storm+Wukong 3 orders of magnitudespeedup vs. Spark Streaming 0 10 20 30 40

34

Backup: LSBench w/o RDMA