50
Streaming Report Functional Comparison and Performance Evaluation Huafeng Wang Wei Mao Tianlun Zhang 2016/9/27

Functional Comparison and Performance Evaluation of Streaming Frameworks

Embed Size (px)

Citation preview

Page 1: Functional Comparison and Performance Evaluation of Streaming Frameworks

Streaming ReportFunctional Comparison and Performance EvaluationHuafeng Wang

Wei MaoTianlun Zhang2016/9/27

Page 2: Functional Comparison and Performance Evaluation of Streaming Frameworks

2

Overview Streaming Core

MISC

Performance Benchmark

Choose your weapon !

*Other names and brands may be claimed as the property of others.

Page 3: Functional Comparison and Performance Evaluation of Streaming Frameworks

Execution Model + Fault Tolerance Mechanism

Page 4: Functional Comparison and Performance Evaluation of Streaming Frameworks

4

Apache Spark

Streaming*AapcheFlink*

ApacheStorm*

Apache Storm

Trident*Apache

Gearpump*TwitterHeron*

This is the critical part, as it affects many features

Micro-BatchCheckpoint per Batch

Continuous StreamingCheckpoint “per

Batch”

Source Operator Sink

Acker

Source Operator Sink

JobManager/

HDFS

id offset state str

ack

Source Operator Sink

Driver

Storage

Storage

job status

HDFS

id offset state str

Continuous StreamingAck per Record

Storage

*Other names and brands may be claimed as the property of others.

Page 5: Functional Comparison and Performance Evaluation of Streaming Frameworks

5

Low Latency High Latency

High ThroughputLow Throughput

High Overhead Low Overhead

Apache Spark

Streaming*AapcheFlink*

ApacheStorm*

Apache Storm

Trident*Apache

Gearpump*TwitterHeron*

*Other names and brands may be claimed as the property of others.

Micro-BatchCheckpoint per Batch

Continuous StreamingCheckpoint “per

Batch”

Continuous StreamingAck per Record

Page 6: Functional Comparison and Performance Evaluation of Streaming Frameworks

6

Delivery Guarantee

At least once Exactly once

• Ackers know about if a record is processed successfully or not. If it failed, replay it.

• There is no state consistency guarantee.

• State is persisted in durable storage

• Checkpoint is linked with state storage per Batch

Apache Spark

Streaming*AapcheFlink*

ApacheStorm*

Apache Storm

Trident*Apache

Gearpump*TwitterHeron*

*Other names and brands may be claimed as the property of others.

Page 7: Functional Comparison and Performance Evaluation of Streaming Frameworks

7

Native State Operator

Yes* Yes Yes• Flink Java API:

ValueState ListState ReduceState

• Flink Scala API: mapWithState

• Gearpump persistState

• Spark 1.5: updateStateByKey

• Spark 1.6: mapWithState

• Trident: persistentAggregat

e State

• Storm: KeyValueStat

e

• Heron:X User Maintain

Apache Spark

Streaming*AapcheFlink*

ApacheStorm*

Apache Storm

Trident*Apache

Gearpump*TwitterHeron*

*Other names and brands may be claimed as the property of others.

Page 8: Functional Comparison and Performance Evaluation of Streaming Frameworks

8

Dynamic Load Balance & Recovery Speed

Source

exec

exec

exec

10s + 5s = 15s

5s Source

exec

exec

exec

10s

10s

10s10s + 5s = 15s

Apache Spark

Streaming*AapcheFlink*

ApacheStorm*

Apache Storm

Trident*Apache

Gearpump*TwitterHeron*

*Other names and brands may be claimed as the property of others.

Page 9: Functional Comparison and Performance Evaluation of Streaming Frameworks

API

Page 10: Functional Comparison and Performance Evaluation of Streaming Frameworks

10

Compositional

• Highly customizable operator based on basic building blocks• Manual topology definition and optimization

TopologyBuilder builder = new TopologyBuilder();builder.setSpout(“input", new RandomSentenceSpout(), 1);builder.setBolt("split", new SplitSentence(), 3).shuffleGrouping("spout");builder.setBolt("count", new WordCount(), 2).fieldsGrouping("split", new Fields("word"));

input split count“foo, foo, bar” “foo”, “foo”, “bar” {“foo”: 2, “bar”: 1}

Spout Bolt Bolt

*Other names and brands may be claimed as the property of others.

ApacheStorm*

ApacheGearpump*

TwitterHeron*

Page 11: Functional Comparison and Performance Evaluation of Streaming Frameworks

11

Declarative

• Higher order function as operators (filter, mapWithState…)• Logical plan optimization

DataStream<String> text = env.readTextFile(params.get("input"));DataStream<Tuple2<String, Integer>> counts = text.flatMap(new Tokenizer()).keyBy(0).sum(1);

read flatMap keyBy sum

“foo, foo, bar” “foo”, “foo”, “bar” {“foo”: 1, “foo”: 1, “bar”: 1}

{“foo”: 2, “bar”: 1}

*Other names and brands may be claimed as the property of others.

Apache Spark

Streaming*

AapcheFlink*

Apache Storm

Trident*

ApacheGearpump*

Page 12: Functional Comparison and Performance Evaluation of Streaming Frameworks

12

Statistical• Data scientist friendly• Dynamic type

Pythonlines = ssc.textFileStream(params.get("input"))words = lines.flatMap(lambda line: line.split(“,"))pairs = words.map(lambda word: (word, 1))counts = pairs.reduceByKey(lambda x, y: x + y)counts.saveAsTextFiles(params.get("output"))

Rlines <- textFile(sc, “input”)words <- flatMap(lines, function(line) {

strsplit(line, “ ”)[[1]]})

wordCount <- lapply(words, function(word) {list(word, 1L)

}counts <- reduceByKey(wordCount, “+”, 2L)

˚StructuredStreaming*

*Other names and brands may be claimed as the property of others.

Apache Spark

Streaming*ApacheStorm*

TwitterHeron*

˚ApacheStorm*

Page 13: Functional Comparison and Performance Evaluation of Streaming Frameworks

13

SQLSQL

ParserSQL

Statements

OptimizerStreaming Statement

s

CREATE EXTERNAL TABLE ORDERS (ID INT PRIMARY KEY, UNIT_PRICE INT, QUANTITY INT) LOCATION 'kafka://localhost:2181/brokers?topic=orders' TBLPROPERTIES '{...}}‘

INSERT INTO LARGE_ORDERS SELECT ID, UNIT_PRICE * QUANTITY AS TOTAL FROM ORDERS WHERE UNIT_PRICE * QUANTITY > 50

bin/storm sql XXXX.sql

InputDStream.transform((rdd: RDD[Order], time: Time) => { import sqlContext.implicits._ rdd.toDF.registAsTempTable val SQL = "SELECT ID, UNIT_PRICE * QUANTITY AS TOTAL FROM ORDERS WHERE UNIT_PRICE * QUANTITY > 50" val largeOrderDF = sqlContext.sql(SQL) largeOrderDF.toRDD})

Fusion Style

Pure Style

*Other names and brands may be claimed as the property of others.

Apache Spark

Streaming*AapcheFlink*

StructuredStreamingApache

Storm Trident*

Page 14: Functional Comparison and Performance Evaluation of Streaming Frameworks

14

SummaryCompositional Declarative Python/R SQL

X √ √ √

√ X √ NOT support aggregation,

windowing and joiningX √ X

√ √ X X

X √ XSupport select, from, where,

union

√ X √˚ X

*Other names and brands may be claimed as the property of others.

Apache Spark

Streaming*ApacheStorm*

AapcheFlink*

Apache Storm

Trident*Apache

Gearpump*

TwitterHeron*

Page 15: Functional Comparison and Performance Evaluation of Streaming Frameworks

Runtime Model

Page 16: Functional Comparison and Performance Evaluation of Streaming Frameworks

16

• Multi Tasks of Multi Applications on Single Process

JVM Process Connect

with local SM

Thread Thread

Task

• Single Task on Single Process

Thread Thread

Task Task

JVM Process

Thread Thread

Task Task

JVM Process

Thread

Task

task from application A task from application BTaskTask

JVM Process Connect

with local SM

Thread

Task

Thread

*Other names and brands may be claimed as the property of others.

TwitterHeron*

AapcheFlink*

Page 17: Functional Comparison and Performance Evaluation of Streaming Frameworks

17

• Multi Tasks of Single application on Single Processo Single task on single thread

o Multi tasks on single thread

Thread

Task

Thread

TaskTaskTask

Task

JVM Process

Thread Thread

Task Task

JVM Process

Thread Thread

Task Task

JVM Process

Thread

Task

Thread

Task

Thread

TaskTask

JVM Process

*Other names and brands may be claimed as the property of others.

Apache Spark

Streaming*

ApacheStorm*

Apache Storm

Trident*Apache

Gearpump*

Page 18: Functional Comparison and Performance Evaluation of Streaming Frameworks

MISC● Window Support ● Out-of-order Processing ● Memory Management

● Resource Management ● Web UI ● Community Maturity

Page 19: Functional Comparison and Performance Evaluation of Streaming Frameworks

19

Window Support• Sliding Window

smaller than gap

session gap

t t

• Count Window

• Session Window

Sliding Window Count Window Session Window

√ X X˚

√ √ X

√ √ X

√˚ X X

√ √ √

X X X

Apache Spark

Streaming*

Apache Flink*

Apache Storm*Apache Storm

Trident*Apache Gearpump*

Apache Heron*

*Other names and brands may be claimed as the property of others.

Page 20: Functional Comparison and Performance Evaluation of Streaming Frameworks

20

Out-of-order ProcessingProcessing Time Event Time Watermark

√ √˚ X˚

√ √ √

√ X X

√ √ √

√ √ √

√ X X

*Other names and brands may be claimed as the property of others.

Apache Spark

Streaming*ApacheStorm*

AapcheFlink*

Apache Storm

Trident*Apache

Gearpump*

TwitterHeron*

Page 21: Functional Comparison and Performance Evaluation of Streaming Frameworks

21

Memory ManagementJVM Manage Self Manage on-heap Self Manage off-heap

√ √˚ √˚

√ √ √

√ X X

√ X X

√ X X

*Other names and brands may be claimed as the property of others.

Apache Spark

Streaming*AapcheFlink*

ApacheStorm*

ApacheGearpump*

TwitterHeron*

Page 22: Functional Comparison and Performance Evaluation of Streaming Frameworks

22

Resource ManagementStandalone YARN Mesos

√ √ √

√ √˚ √˚

√ √˚ √˚

√ √ X

√ √ X

√ √ √

*Other names and brands may be claimed as the property of others.

Apache Spark

Streaming*ApacheStorm*

AapcheFlink*

Apache Storm

Trident*Apache

Gearpump*

TwitterHeron*

Page 23: Functional Comparison and Performance Evaluation of Streaming Frameworks

23

Web UISubmit Jobs

Cancel Jobs

Inspect Jobs

ShowStatistic

s

ShowInput Rate

Check Exception

s

Inspect

ConfigAlert

X √ √ √ √ √ √ X

X √ √ √ √˚ √ √ X

√ √ √ √ √˚ √ √ X

√ √ √ √ X √ √ X

X X √ √ √˚ √ √ X

ApacheSpark

Streaming*

ApacheFlink*

ApacheStorm*Apache

Gearpump*

*Other names and brands may be claimed as the property of others.

TwitterHeron*

Page 24: Functional Comparison and Performance Evaluation of Streaming Frameworks

24

Spark Storm Gearpump Flink Heron0

5001000150020002500 2161

237 161514

77

Past 3 Months Summary on JIRA Created Resloved

Spark Storm Gearpump Flink Heron0

200400600800

1000780

21721

184 130102 20 5 34 20

Past 1 Months Summary on GitHub

Commits CommittorCommunity Maturity

Initiation Time

Apache Top

ProjectContributors

2013 2014 926

2011 2014 219

2014 Incubator 21

2010 2015 208

2014 N/A 44

*Other names and brands may be claimed as the property of others.

ApacheSpark

Streaming*

ApacheStorm*Apache

Gearpump*

ApacheFlink*

TwitterHeron*

Page 25: Functional Comparison and Performance Evaluation of Streaming Frameworks

Performance BenchmarkHiBench 6.0

Page 26: Functional Comparison and Performance Evaluation of Streaming Frameworks

26

• “Lazy Benchmarking”

• Simple test case infer practical use case

Test Philosophical

Page 27: Functional Comparison and Performance Evaluation of Streaming Frameworks

27

The SetupApache Kafka* Cluster

• CPU: 2 x Intel(R) Xeon(R) CPU E5-2699 v3@ 2.30GHz

• Mem: 128 GB• Disk: 8 x HDD (1TB)• Network: 10 Gbps

10 Gbps

Test Cluster

• CPU: 2 x Intel(R) Xeon(R) CPU E5-2697 v2@ 2.70GHz

• Core: 20 / 24• Mem: 80 / 128 GB• Disk: 8 x HDD (1TB )• Network: 10 Gbps

x7

x3Name Version

Java 1.8 Scala 2.11.7

Apache Hadoop* 2.6.2Apache Zookeeper* 3.4.8

Apache Kafka* 0.8.2.2Apache Spark* 1.6.1 Apache Storm* 1.0.1 Apache Flink* 1.0.3

Apache Gearpump* 0.8.1

• Apache Heron* require specific Operation System (Ubuntu / CentOS/ Mac OS )• Structured Streaming doesn’t support Kafka source yet   (Spark 2.0 )

*Other names and brands may be claimed as the property of others.

Page 28: Functional Comparison and Performance Evaluation of Streaming Frameworks

28

ArchitectureTest Cluster (Standalone)

Data Generator

Metrics Reader

File System

Topic A

Kafka Broker

Kafka Broker

Kafka Broker

Client Master

Slave

20 Core80G Mem

Slave

20 Core80G Mem

Slave

20 Core80G Mem

Slave

20 Core80G Mem

Slave

20 Core80G Mem

Slave

20 Core80G Mem

Slave

20 Core80G Mem

Topic A

Topic BTo

pic

B

Result

In Time

Out Time

Out Time – In Time

Page 29: Functional Comparison and Performance Evaluation of Streaming Frameworks

29

Framework Configuration

Framework Related Configuration

7 Executor140 Parallelism7 TaskManager140 Parallelism

28 Worker140 KafkaSpout

28 Executors140 KafkaSource

*Other names and brands may be claimed as the property of others.

Apache Spark

Streaming*

ApacheStorm*

AapcheFlink*

ApacheGearpump*

Page 30: Functional Comparison and Performance Evaluation of Streaming Frameworks

30

Raw Input Data

• Kafka Topic Partition: 140• Size Per Message (configurable): 200 bytes• Raw Input Message Example:“0,227.209.164.46,nbizrgdziebsaecsecujfjcqtvnpcnxxwiopmddorcxnlijdizgoi,1991-06-10,0.115967035,Mozilla/5.0 (iPhone; U; CPU like Mac OS X)AppleWebKit/420.1 (KHTML like Gecko) Version/3.0 Mobile/4A93Safari/419.3,YEM,YEM-AR,snowdrops,1”

• Strong Type: class UserVisit (ip, sessionId, browser)

• Keep feeding data at specific rate for 5 minutes5 minutes

Page 31: Functional Comparison and Performance Evaluation of Streaming Frameworks

31

Data Input Rate

Throughput Message/Second Kafka Producer Num

40KB/s 0.2K 1400KB/s 2K 1 4MB/s 20K 1 40MB/s 200K 1 80MB/s 400K 1400MB/s 2M 10600MB/s 3M 15800MB/s 4M 20

Page 32: Functional Comparison and Performance Evaluation of Streaming Frameworks

32

Let’s start with the simplest case

Page 33: Functional Comparison and Performance Evaluation of Streaming Frameworks

33

Test Case: IdentityThe application reads input data from Kafka and then writes result to Kafka immediately, there is no complex business logic involved.

Source

Kafka

Page 34: Functional Comparison and Performance Evaluation of Streaming Frameworks

34

Result

0 100 200 300 400 500 600 700 8000

10002000300040005000600070008000

P99 Latency (s)

Apache Spark* Apache Flink*Apache Storm* without Ack Apache Storm* with Ack

Input Rate (MB/s)

*Other names and brands may be claimed as the property of others. For more complete information about performance and benchmark results, visit www.intel.com/benchmarks. Results have been estimated or simulated using internal Intel analysis or architecture simulation or modeling, and provided to you for informational purposes. Any differences in your system hardware, software or configuration may affect your actual performance.

Page 35: Functional Comparison and Performance Evaluation of Streaming Frameworks

35

Q: What if source data are skew or even packed?

Page 36: Functional Comparison and Performance Evaluation of Streaming Frameworks

36

Test Case: RepartitionBasically, this test case can stand for the efficiency of data shuffle.

Source

Kafka

Reporter

Network Shuffle

Page 37: Functional Comparison and Performance Evaluation of Streaming Frameworks

37

Result

0 100 200 300 400 500 600 700 800050000

100000150000200000250000300000350000400000

P99 Latency (s)

Apache Spark*Apache Flink*Apache Storm* without AckApache Gearpump*Apache Storm* with Ack

Input Rate (MB/s)0 100 200 300 400 500 600 700 8000

100200300400500600700800

Throughput (MB/s)

Apache Spark*Apache Flink*Apache Storm* without AckApache Gearpump*Apache Storm* with Ack

Input Rate (MB/s)

*Other names and brands may be claimed as the property of others. For more complete information about performance and benchmark results, visit www.intel.com/benchmarks. Results have been estimated or simulated using internal Intel analysis or architecture simulation or modeling, and provided to you for informational purposes. Any differences in your system hardware, software or configuration may affect your actual performance.

Page 38: Functional Comparison and Performance Evaluation of Streaming Frameworks

38

Observation• Flink and Storm has close performance and are better choices to

meet sub-second SLA requirement if no repartition happened.• Spark Streaming need to schedule task with additional context.

Under tiny batch interval case, the overhead could be dramatic worse compared to other frameworks.

• According to our test, minimum Batch Interval of Spark is about 80ms (140 tasks per batch), otherwise task schedule delay will keep increasing

• Repartition is heavy for every framework, but usually it’s unavoidable.

• Latency of Gearpump is still quite low even under 800MB/s input throughput.

Page 39: Functional Comparison and Performance Evaluation of Streaming Frameworks

39

Q: What if I want to apply slightly complex logic which need to maintain entire state?

Page 40: Functional Comparison and Performance Evaluation of Streaming Frameworks

40

Test Case: Stateful WordCountNative state operator is supported by all frameworks we evaluatedStateful operator performance + Checkpoint/Acker cost

Projection

Kafka

State Reporter

Page 41: Functional Comparison and Performance Evaluation of Streaming Frameworks

41

Result

0 100 200 300 400 500 600 700 8000100002000030000400005000060000700008000090000

100000P99 Latency (s)

Apache Spark* Apache Flink*Apache Flink* without CP Apache Storm*Apache Gearpump*

Input Rate (MB/s)0 100 200 300 400 500 600 700 8000

100200300400500600700800

Throughput (MB/s)

Apache Spark* Apache Flink*Apache Storm* Gearpump*

Input Rate (MB/s)

*Other names and brands may be claimed as the property of others. For more complete information about performance and benchmark results, visit www.intel.com/benchmarks. Results have been estimated or simulated using internal Intel analysis or architecture simulation or modeling, and provided to you for informational purposes. Any differences in your system hardware, software or configuration may affect your actual performance.

Page 42: Functional Comparison and Performance Evaluation of Streaming Frameworks

42

Observation• Exactly-once semantics usually require state management and

checkpoint. But better guarantees come at high cost.

• There is no obvious performance difference in Flink when switching fault tolerance on or off.

• Checkpoint mechanisms and storages play a critical role here.

Page 43: Functional Comparison and Performance Evaluation of Streaming Frameworks

43

Q: How about Window Operation?

Page 44: Functional Comparison and Performance Evaluation of Streaming Frameworks

44

Test Case: Window Based AggregationThis test case manages a 10-seconds sliding window

Projection

Kafka

Window Reporter

Page 45: Functional Comparison and Performance Evaluation of Streaming Frameworks

45

Result

0 100 200 300 400 500 600 700 800020000400006000080000

100000120000140000160000180000200000

P99 Latency (s)

Apache Spark* Apache Flink* Storm*

Input Rate (MB/s)0 100 200 300 400 500 600 700 8000

100

200

300

400

500

600Throughput (MB/s)

Apache Spark* Apache Flink* Storm*

Input Rate (MB/s)

*Other names and brands may be claimed as the property of others. For more complete information about performance and benchmark results, visit www.intel.com/benchmarks. Results have been estimated or simulated using internal Intel analysis or architecture simulation or modeling, and provided to you for informational purposes. Any differences in your system hardware, software or configuration may affect your actual performance.

Page 46: Functional Comparison and Performance Evaluation of Streaming Frameworks

46

The native streaming execution model helps hereObservation

Source Window ReportInputStream OutputStream

Apache Spark

Streaming*ApacheStorm*AapcheFlink*

*Other names and brands may be claimed as the property of others.

Page 47: Functional Comparison and Performance Evaluation of Streaming Frameworks

47

So which streaming framework should I use?

Page 48: Functional Comparison and Performance Evaluation of Streaming Frameworks

48

Do your own benchmark

HiBench : a cross platforms micro-benchmark suite for big data (https://github.com/intel-hadoop/HiBench)

Open Source since 2012

Better streaming benchmark supporting will be included in next release [HiBench 6.0]

Page 49: Functional Comparison and Performance Evaluation of Streaming Frameworks
Page 50: Functional Comparison and Performance Evaluation of Streaming Frameworks

50

Legal DisclaimerNo license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document.

Intel does not control or audit third-party benchmark data or the web sites referenced in this document. You should visit the referenced web site and confirm whether referenced data are accurate.

Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries.

Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using specific computer systems, components, software, operations and functions. Any change to any of those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases, including the performance of that product when combined with other products.

*Other names and brands may be claimed as the property of others.

Copyright ©2016 Intel Corporation.