SlideShare a Scribd company logo
Stephan Ewen
@stephanewen
The Stream Processor
as a Database
Apache Flink
2
Streaming technology is enabling the obvious:
continuous processing on data that is
continuously produced
Apache Flink Stack
3
DataStream API
Stream Processing
DataSet API
Batch Processing
Runtime
Distributed Streaming Data Flow
Libraries
Streaming and batch as first class citizens.
Programs and Dataflows
4
Source
Transformation
Transformation
Sink
val lines: DataStream[String] = env.addSource(new FlinkKafkaConsumer09(…))
val events: DataStream[Event] = lines.map((line) => parse(line))
val stats: DataStream[Statistic] = stream
.keyBy("sensor")
.timeWindow(Time.seconds(5))
.apply(new MyAggregationFunction())
stats.addSink(new RollingSink(path))
Source
[1]
map()
[1]
keyBy()/
window()/
apply()
[1]
Sink
[1]
Source
[2]
map()
[2]
keyBy()/
window()/
apply()
[2]
Streaming
Dataflow
What makes Flink flink?
5
Low latency
High Throughput
Well-behaved
flow control
(back pressure)
Make more sense of data
Works on real-time
and historic data
True
Streaming
Event Time
APIs
Libraries
Stateful
Streaming
Globally consistent
savepoints
Exactly-once semantics
for fault tolerance
Windows &
user-defined state
Flexible windows
(time, count, session, roll-your own)
Complex Event Processing
The (Classic) Use Case
Realtime Counts and Aggregates
6
(Real)Time Series Statistics
7
stream of events realtime statistics
The Architecture
8
collect log analyze serve & store
The Flink Job
9
case class Impressions(id: String, impressions: Long)
val events: DataStream[Event] =
env.addSource(new FlinkKafkaConsumer09(…))
val impressions: DataStream[Impressions] = events
.filter(evt => evt.isImpression)
.map(evt => Impressions(evt.id, evt.numImpressions)
val counts: DataStream[Impressions]= stream
.keyBy("id")
.timeWindow(Time.hours(1))
.sum("impressions")
The Flink Job
10
Kafka
Source
map()
window()/
sum()
Sink
Kafka
Source
map()
window()/
sum()
Sink
filter()
filter()
keyBy()
keyBy()
Putting it all together
11
Periodically (every second)
flush new aggregates
to Redis
How does it perform?
12
Latency Throughput
Number of
Keys
99th Percentile
Latency (sec)
9
8
2
1
Storm 0.10
Flink 0.10
60 80 100 120 140 160 180
Throughput
(1000 events/sec)
Spark Streaming 1.5
Yahoo! Streaming Benchmark
13
Latency
(lower is better)
Extended Benchmark: Throughput
14
Throughput
• 10 Kafka brokers with 2 partitions each
• 10 compute machines (Flink / Storm)
• Xeon E3-1230-V2@3.30GHz CPU (4 cores HT)
• 32 GB RAM (only 8GB allocated to JVMs)
• 10 GigE Ethernet between compute nodes
• 1 GigE Ethernet between Kafka cluster and Flink nodes
Scaling Number of Users
 Yahoo! Streaming Benchmark has 100 keys only
• Every second, only 100 keys are written to
key/value store
• Quite few, compared to many real world use cases
 Tweet impressions: millions keys/hour
• Up to millions of keys updated per second
15
Number of
Keys
Performance
16
Number of
Keys
The Bottleneck
17
Writes to the key/value
store take too long
Queryable State
18
Queryable State
19
Queryable State
20
Optional, and
only at the end of
windows
Queryable State Enablers
 Flink has state as a first class citizen
 State is fault tolerant (exactly once semantics)
 State is partitioned (sharded) together with the operators
that create/update it
 State is continuous (not mini batched)
 State is scalable (e.g., embedded RocksDB state backend)
21
Queryable State Status
 [FLINK-3779] / Pull Request #2051 :
Queryable State Prototype
 Design and implementation under evolution
 Some experiments were using earlier versions of the
implementation
 Exact numbers may differ in final implementation, but order
of magnitude is comparable
22
Queryable State Performance
23
Queryable State: Application View
24
Application only interested in latest realtime results
Application
Queryable State: Application View
25
Application requires both latest realtime- and older results
Database
realtime results older results
Application Query Service
current time
windows
past time
windows
Apache Flink Architecture Review
26
Queryable State: Implementation
27
Query Client
State
Registry
window()/
sum()
Job Manager Task Manager
ExecutionGraph
State Location Server
deploy
status
Query: /job/operation/state-name/key
State
Registry
window()/
sum()
Task Manager
(1) Get location of "key-partition"
for "operator" of" job"
(2) Look up
location
(3)
Respond location
(4) Query
state-name and key
local
state
register
Contrasting with key/value stores
28
Turning the Database Inside Out
 Cf. Martin Kleppman's talks on
re-designing data warehousing
based on log-centric processing
 This view angle picks up some of
these concepts
 Queryable State in Apache Flink = (Turning DB inside out)++
29
Write Path in Cassandra (simplified)
30
From the Apache Cassandra docs
Write Path in Cassandra (simplified)
31
From the Apache Cassandra docs
First step is durable write to the commit log
(in all databases that offer strong durability)
Memtable is a re-computable
view of the commit log
actions and the persistent SSTables)
Write Path in Cassandra (simplified)
32
From the Apache Cassandra docs
First step is durable write to the commit log
(in all databases that offer strong durability)
Memtable is a re-computable
view of the commit log
actions and the persistent SSTables)
Replication to Quorum
before write is acknowledged
Durability of Queryable state
33
snapshot
state
Durability of Queryable state
34
Event sequence is the ground truth and
is durably stored in the log already
Queryable state
re-computable
from checkpoint and log
snapshot
state Snapshot replication
can happen in the
background
Performance of Flink's State
35
window()/
sum()
Source /
filter() /
map()
State index
(e.g., RocksDB)
Events are persistent
and ordered (per partition / key)
in the log (e.g., Apache Kafka)
Events flow without replication or synchronous writes
Performance of Flink's State
36
window()/
sum()
Source /
filter() /
map()
Trigger checkpoint Inject checkpoint barrier
Performance of Flink's State
37
window()/
sum()
Source /
filter() /
map()
Take state snapshot RocksDB:
Trigger state
copy-on-write
Performance of Flink's State
38
window()/
sum()
Source /
filter() /
map()
Persist state snapshots Durably persist
snapshots
asynchronously
Processing pipeline continues
Conclusion
39
Takeaways
 Streaming applications are often not bound by the stream
processor itself. Cross system interaction is frequently biggest
bottleneck
 Queryable state mitigates a big bottleneck: Communication
with external key/value stores to publish realtime results
 Apache Flink's sophisticated support for state makes this
possible
40
Takeaways
Performance of Queryable State
 Data persistence is fast with logs (Apache Kafka)
• Append only, and streaming replication
 Computed state is fast with local data structures and no
synchronous replication (Apache Flink)
 Flink's checkpoint method makes computed state persistent
with low overhead
41
Go Flink!
42
Low latency
High Throughput
Well-behaved
flow control
(back pressure)
Make more sense of data
Works on real-time
and historic data
True
Streaming
Event Time
APIs
Libraries
Stateful
Streaming
Globally consistent
savepoints
Exactly-once semantics
for fault tolerance
Windows &
user-defined state
Flexible windows
(time, count, session, roll-your own)
Complex Event Processing
Flink Forward 2016, Berlin
Submission deadline: June 30, 2016
Early bird deadline: July 15, 2016
www.flink-forward.org
We are hiring!
data-artisans.com/careers

More Related Content

What's hot (20)

PPTX
Flink Forward Berlin 2017: Hao Wu - Large Scale User Behavior Analytics by Flink
Flink Forward
 
PPTX
data Artisans Product Announcement
Flink Forward
 
PDF
Unify Enterprise Data Processing System Platform Level Integration of Flink a...
Flink Forward
 
PPTX
Flink Streaming @BudapestData
Gyula Fóra
 
PDF
Marton Balassi – Stateful Stream Processing
Flink Forward
 
PPTX
Architecture of Flink's Streaming Runtime @ ApacheCon EU 2015
Robert Metzger
 
PDF
Stream Processing with Apache Flink (Flink.tw Meetup 2016/07/19)
Apache Flink Taiwan User Group
 
PPTX
Real-time Stream Processing with Apache Flink
DataWorks Summit
 
PDF
Tzu-Li (Gordon) Tai - Stateful Stream Processing with Apache Flink
Ververica
 
PDF
Stateful Distributed Stream Processing
Gyula Fóra
 
PDF
Flink Forward San Francisco 2018: Stefan Richter - "How to build a modern str...
Flink Forward
 
PPTX
Apache Flink at Strata San Jose 2016
Kostas Tzoumas
 
PPTX
Taking a look under the hood of Apache Flink's relational APIs.
Fabian Hueske
 
PPTX
Aljoscha Krettek - The Future of Apache Flink
Flink Forward
 
PDF
Flink Forward SF 2017: Srikanth Satya & Tom Kaitchuck - Pravega: Storage Rei...
Flink Forward
 
PPTX
Flink history, roadmap and vision
Stephan Ewen
 
PDF
Tran Nam-Luc – Stale Synchronous Parallel Iterations on Flink
Flink Forward
 
PPTX
Apache Flink@ Strata & Hadoop World London
Stephan Ewen
 
PDF
Flink Forward Berlin 2017: Jörg Schad, Till Rohrmann - Apache Flink meets Apa...
Flink Forward
 
PPTX
Apache flink 1.7 and Beyond
Till Rohrmann
 
Flink Forward Berlin 2017: Hao Wu - Large Scale User Behavior Analytics by Flink
Flink Forward
 
data Artisans Product Announcement
Flink Forward
 
Unify Enterprise Data Processing System Platform Level Integration of Flink a...
Flink Forward
 
Flink Streaming @BudapestData
Gyula Fóra
 
Marton Balassi – Stateful Stream Processing
Flink Forward
 
Architecture of Flink's Streaming Runtime @ ApacheCon EU 2015
Robert Metzger
 
Stream Processing with Apache Flink (Flink.tw Meetup 2016/07/19)
Apache Flink Taiwan User Group
 
Real-time Stream Processing with Apache Flink
DataWorks Summit
 
Tzu-Li (Gordon) Tai - Stateful Stream Processing with Apache Flink
Ververica
 
Stateful Distributed Stream Processing
Gyula Fóra
 
Flink Forward San Francisco 2018: Stefan Richter - "How to build a modern str...
Flink Forward
 
Apache Flink at Strata San Jose 2016
Kostas Tzoumas
 
Taking a look under the hood of Apache Flink's relational APIs.
Fabian Hueske
 
Aljoscha Krettek - The Future of Apache Flink
Flink Forward
 
Flink Forward SF 2017: Srikanth Satya & Tom Kaitchuck - Pravega: Storage Rei...
Flink Forward
 
Flink history, roadmap and vision
Stephan Ewen
 
Tran Nam-Luc – Stale Synchronous Parallel Iterations on Flink
Flink Forward
 
Apache Flink@ Strata & Hadoop World London
Stephan Ewen
 
Flink Forward Berlin 2017: Jörg Schad, Till Rohrmann - Apache Flink meets Apa...
Flink Forward
 
Apache flink 1.7 and Beyond
Till Rohrmann
 

Viewers also liked (20)

PPTX
Apache Flink Overview at SF Spark and Friends
Stephan Ewen
 
PPTX
Kostas Tzoumas - Stream Processing with Apache Flink®
Ververica
 
PPTX
Robert Metzger - Connecting Apache Flink to the World - Reviewing the streami...
Flink Forward
 
PPTX
Flink vs. Spark
Slim Baltagi
 
PDF
Big Data Warsaw
Maximilian Michels
 
PPTX
Hadoop Summit Europe Talk 2014: Apache Hadoop YARN: Present and Future
Vinod Kumar Vavilapalli
 
PPTX
Streaming in the Wild with Apache Flink
Kostas Tzoumas
 
PPTX
Apache Flink Community Updates November 2016 @ Berlin Meetup
Robert Metzger
 
PPTX
A Data Streaming Architecture with Apache Flink (berlin Buzzwords 2016)
Robert Metzger
 
PDF
Streaming Analytics & CEP - Two sides of the same coin?
Till Rohrmann
 
PDF
Apache Spark vs Apache Flink
AKASH SIHAG
 
PDF
Interactive Data Analysis with Apache Flink @ Flink Meetup in Berlin
Till Rohrmann
 
PDF
Jamie Grier - Robust Stream Processing with Apache Flink
Flink Forward
 
PPTX
Kostas Tzoumas_Stephan Ewen - Keynote -The maturing data streaming ecosystem ...
Flink Forward
 
PPTX
Fabian Hueske_Till Rohrmann - Declarative stream processing with StreamSQL an...
Flink Forward
 
PPTX
Stephan Ewen - Running Flink Everywhere
Flink Forward
 
PDF
Till Rohrmann - Dynamic Scaling - How Apache Flink adapts to changing workloads
Flink Forward
 
PPTX
Stephan Ewen - Scaling to large State
Flink Forward
 
PPTX
The Stream Processor as a Database Apache Flink
DataWorks Summit/Hadoop Summit
 
PPTX
Keynote: Stephan Ewen - Stream Processing as a Foundational Paradigm and Apac...
Ververica
 
Apache Flink Overview at SF Spark and Friends
Stephan Ewen
 
Kostas Tzoumas - Stream Processing with Apache Flink®
Ververica
 
Robert Metzger - Connecting Apache Flink to the World - Reviewing the streami...
Flink Forward
 
Flink vs. Spark
Slim Baltagi
 
Big Data Warsaw
Maximilian Michels
 
Hadoop Summit Europe Talk 2014: Apache Hadoop YARN: Present and Future
Vinod Kumar Vavilapalli
 
Streaming in the Wild with Apache Flink
Kostas Tzoumas
 
Apache Flink Community Updates November 2016 @ Berlin Meetup
Robert Metzger
 
A Data Streaming Architecture with Apache Flink (berlin Buzzwords 2016)
Robert Metzger
 
Streaming Analytics & CEP - Two sides of the same coin?
Till Rohrmann
 
Apache Spark vs Apache Flink
AKASH SIHAG
 
Interactive Data Analysis with Apache Flink @ Flink Meetup in Berlin
Till Rohrmann
 
Jamie Grier - Robust Stream Processing with Apache Flink
Flink Forward
 
Kostas Tzoumas_Stephan Ewen - Keynote -The maturing data streaming ecosystem ...
Flink Forward
 
Fabian Hueske_Till Rohrmann - Declarative stream processing with StreamSQL an...
Flink Forward
 
Stephan Ewen - Running Flink Everywhere
Flink Forward
 
Till Rohrmann - Dynamic Scaling - How Apache Flink adapts to changing workloads
Flink Forward
 
Stephan Ewen - Scaling to large State
Flink Forward
 
The Stream Processor as a Database Apache Flink
DataWorks Summit/Hadoop Summit
 
Keynote: Stephan Ewen - Stream Processing as a Foundational Paradigm and Apac...
Ververica
 
Ad

Similar to The Stream Processor as the Database - Apache Flink @ Berlin buzzwords (20)

PDF
Building Applications with Streams and Snapshots
J On The Beach
 
PDF
Flink Forward SF 2017: Stefan Richter - Improvements for large state and reco...
Flink Forward
 
PDF
Apache Flink: Better, Faster & Uncut - Piotr Nowojski, data Artisans
Evention
 
PPTX
2018-04 Kafka Summit London: Stephan Ewen - "Apache Flink and Apache Kafka fo...
Ververica
 
PDF
Apache Flink @ Tel Aviv / Herzliya Meetup
Robert Metzger
 
PDF
Real-time Stream Processing with Apache Flink @ Hadoop Summit
Gyula Fóra
 
PPTX
Flexible and Real-Time Stream Processing with Apache Flink
DataWorks Summit
 
PPTX
GOTO Night Amsterdam - Stream processing with Apache Flink
Robert Metzger
 
PPTX
Apache Flink Meetup Munich (November 2015): Flink Overview, Architecture, Int...
Robert Metzger
 
PPTX
A Deep Dive into Structured Streaming: Apache Spark Meetup at Bloomberg 2016
Databricks
 
PPTX
First Flink Bay Area meetup
Kostas Tzoumas
 
PPTX
Flink 0.10 @ Bay Area Meetup (October 2015)
Stephan Ewen
 
PDF
Advanced Streaming Analytics with Apache Flink and Apache Kafka, Stephan Ewen
confluent
 
PDF
Apache Flink Stream Processing
Suneel Marthi
 
PDF
Taking Spark Streaming to the Next Level with Datasets and DataFrames
Databricks
 
PPTX
QCon London - Stream Processing with Apache Flink
Robert Metzger
 
PPTX
Flink Streaming Hadoop Summit San Jose
Kostas Tzoumas
 
PPTX
Unified batch and stream processing with Flink @ Big Data Beers Berlin May 2015
Robert Metzger
 
PDF
K. Tzoumas & S. Ewen – Flink Forward Keynote
Flink Forward
 
PDF
Apache Spark 2.0: A Deep Dive Into Structured Streaming - by Tathagata Das
Databricks
 
Building Applications with Streams and Snapshots
J On The Beach
 
Flink Forward SF 2017: Stefan Richter - Improvements for large state and reco...
Flink Forward
 
Apache Flink: Better, Faster & Uncut - Piotr Nowojski, data Artisans
Evention
 
2018-04 Kafka Summit London: Stephan Ewen - "Apache Flink and Apache Kafka fo...
Ververica
 
Apache Flink @ Tel Aviv / Herzliya Meetup
Robert Metzger
 
Real-time Stream Processing with Apache Flink @ Hadoop Summit
Gyula Fóra
 
Flexible and Real-Time Stream Processing with Apache Flink
DataWorks Summit
 
GOTO Night Amsterdam - Stream processing with Apache Flink
Robert Metzger
 
Apache Flink Meetup Munich (November 2015): Flink Overview, Architecture, Int...
Robert Metzger
 
A Deep Dive into Structured Streaming: Apache Spark Meetup at Bloomberg 2016
Databricks
 
First Flink Bay Area meetup
Kostas Tzoumas
 
Flink 0.10 @ Bay Area Meetup (October 2015)
Stephan Ewen
 
Advanced Streaming Analytics with Apache Flink and Apache Kafka, Stephan Ewen
confluent
 
Apache Flink Stream Processing
Suneel Marthi
 
Taking Spark Streaming to the Next Level with Datasets and DataFrames
Databricks
 
QCon London - Stream Processing with Apache Flink
Robert Metzger
 
Flink Streaming Hadoop Summit San Jose
Kostas Tzoumas
 
Unified batch and stream processing with Flink @ Big Data Beers Berlin May 2015
Robert Metzger
 
K. Tzoumas & S. Ewen – Flink Forward Keynote
Flink Forward
 
Apache Spark 2.0: A Deep Dive Into Structured Streaming - by Tathagata Das
Databricks
 
Ad

Recently uploaded (20)

PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
Executive Business Intelligence Dashboards
vandeslie24
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 

The Stream Processor as the Database - Apache Flink @ Berlin buzzwords

  • 1. Stephan Ewen @stephanewen The Stream Processor as a Database Apache Flink
  • 2. 2 Streaming technology is enabling the obvious: continuous processing on data that is continuously produced
  • 3. Apache Flink Stack 3 DataStream API Stream Processing DataSet API Batch Processing Runtime Distributed Streaming Data Flow Libraries Streaming and batch as first class citizens.
  • 4. Programs and Dataflows 4 Source Transformation Transformation Sink val lines: DataStream[String] = env.addSource(new FlinkKafkaConsumer09(…)) val events: DataStream[Event] = lines.map((line) => parse(line)) val stats: DataStream[Statistic] = stream .keyBy("sensor") .timeWindow(Time.seconds(5)) .apply(new MyAggregationFunction()) stats.addSink(new RollingSink(path)) Source [1] map() [1] keyBy()/ window()/ apply() [1] Sink [1] Source [2] map() [2] keyBy()/ window()/ apply() [2] Streaming Dataflow
  • 5. What makes Flink flink? 5 Low latency High Throughput Well-behaved flow control (back pressure) Make more sense of data Works on real-time and historic data True Streaming Event Time APIs Libraries Stateful Streaming Globally consistent savepoints Exactly-once semantics for fault tolerance Windows & user-defined state Flexible windows (time, count, session, roll-your own) Complex Event Processing
  • 6. The (Classic) Use Case Realtime Counts and Aggregates 6
  • 7. (Real)Time Series Statistics 7 stream of events realtime statistics
  • 8. The Architecture 8 collect log analyze serve & store
  • 9. The Flink Job 9 case class Impressions(id: String, impressions: Long) val events: DataStream[Event] = env.addSource(new FlinkKafkaConsumer09(…)) val impressions: DataStream[Impressions] = events .filter(evt => evt.isImpression) .map(evt => Impressions(evt.id, evt.numImpressions) val counts: DataStream[Impressions]= stream .keyBy("id") .timeWindow(Time.hours(1)) .sum("impressions")
  • 11. Putting it all together 11 Periodically (every second) flush new aggregates to Redis
  • 12. How does it perform? 12 Latency Throughput Number of Keys
  • 13. 99th Percentile Latency (sec) 9 8 2 1 Storm 0.10 Flink 0.10 60 80 100 120 140 160 180 Throughput (1000 events/sec) Spark Streaming 1.5 Yahoo! Streaming Benchmark 13 Latency (lower is better)
  • 14. Extended Benchmark: Throughput 14 Throughput • 10 Kafka brokers with 2 partitions each • 10 compute machines (Flink / Storm) • Xeon [email protected] CPU (4 cores HT) • 32 GB RAM (only 8GB allocated to JVMs) • 10 GigE Ethernet between compute nodes • 1 GigE Ethernet between Kafka cluster and Flink nodes
  • 15. Scaling Number of Users  Yahoo! Streaming Benchmark has 100 keys only • Every second, only 100 keys are written to key/value store • Quite few, compared to many real world use cases  Tweet impressions: millions keys/hour • Up to millions of keys updated per second 15 Number of Keys
  • 17. The Bottleneck 17 Writes to the key/value store take too long
  • 20. Queryable State 20 Optional, and only at the end of windows
  • 21. Queryable State Enablers  Flink has state as a first class citizen  State is fault tolerant (exactly once semantics)  State is partitioned (sharded) together with the operators that create/update it  State is continuous (not mini batched)  State is scalable (e.g., embedded RocksDB state backend) 21
  • 22. Queryable State Status  [FLINK-3779] / Pull Request #2051 : Queryable State Prototype  Design and implementation under evolution  Some experiments were using earlier versions of the implementation  Exact numbers may differ in final implementation, but order of magnitude is comparable 22
  • 24. Queryable State: Application View 24 Application only interested in latest realtime results Application
  • 25. Queryable State: Application View 25 Application requires both latest realtime- and older results Database realtime results older results Application Query Service current time windows past time windows
  • 27. Queryable State: Implementation 27 Query Client State Registry window()/ sum() Job Manager Task Manager ExecutionGraph State Location Server deploy status Query: /job/operation/state-name/key State Registry window()/ sum() Task Manager (1) Get location of "key-partition" for "operator" of" job" (2) Look up location (3) Respond location (4) Query state-name and key local state register
  • 29. Turning the Database Inside Out  Cf. Martin Kleppman's talks on re-designing data warehousing based on log-centric processing  This view angle picks up some of these concepts  Queryable State in Apache Flink = (Turning DB inside out)++ 29
  • 30. Write Path in Cassandra (simplified) 30 From the Apache Cassandra docs
  • 31. Write Path in Cassandra (simplified) 31 From the Apache Cassandra docs First step is durable write to the commit log (in all databases that offer strong durability) Memtable is a re-computable view of the commit log actions and the persistent SSTables)
  • 32. Write Path in Cassandra (simplified) 32 From the Apache Cassandra docs First step is durable write to the commit log (in all databases that offer strong durability) Memtable is a re-computable view of the commit log actions and the persistent SSTables) Replication to Quorum before write is acknowledged
  • 33. Durability of Queryable state 33 snapshot state
  • 34. Durability of Queryable state 34 Event sequence is the ground truth and is durably stored in the log already Queryable state re-computable from checkpoint and log snapshot state Snapshot replication can happen in the background
  • 35. Performance of Flink's State 35 window()/ sum() Source / filter() / map() State index (e.g., RocksDB) Events are persistent and ordered (per partition / key) in the log (e.g., Apache Kafka) Events flow without replication or synchronous writes
  • 36. Performance of Flink's State 36 window()/ sum() Source / filter() / map() Trigger checkpoint Inject checkpoint barrier
  • 37. Performance of Flink's State 37 window()/ sum() Source / filter() / map() Take state snapshot RocksDB: Trigger state copy-on-write
  • 38. Performance of Flink's State 38 window()/ sum() Source / filter() / map() Persist state snapshots Durably persist snapshots asynchronously Processing pipeline continues
  • 40. Takeaways  Streaming applications are often not bound by the stream processor itself. Cross system interaction is frequently biggest bottleneck  Queryable state mitigates a big bottleneck: Communication with external key/value stores to publish realtime results  Apache Flink's sophisticated support for state makes this possible 40
  • 41. Takeaways Performance of Queryable State  Data persistence is fast with logs (Apache Kafka) • Append only, and streaming replication  Computed state is fast with local data structures and no synchronous replication (Apache Flink)  Flink's checkpoint method makes computed state persistent with low overhead 41
  • 42. Go Flink! 42 Low latency High Throughput Well-behaved flow control (back pressure) Make more sense of data Works on real-time and historic data True Streaming Event Time APIs Libraries Stateful Streaming Globally consistent savepoints Exactly-once semantics for fault tolerance Windows & user-defined state Flexible windows (time, count, session, roll-your own) Complex Event Processing
  • 43. Flink Forward 2016, Berlin Submission deadline: June 30, 2016 Early bird deadline: July 15, 2016 www.flink-forward.org