SlideShare a Scribd company logo
Apache Apex: Stream Processing Architecture
and Applications
Thomas Weise <thw@apache.org>
@thweise
Spark & Hadoop User Group Munich, July 19th 2016
Stream Data Processing
2
Data
Sources
Events
Logs
Sensor Data
Social
Databases
CDC
Oper1 Oper2 Oper3 Real-time
analytics on
data in motion
Data
Visualization
Industries & Use Cases
3
Financial Services Ad-Tech Telecom Manufacturing Energy IoT
Fraud and risk
monitoring
Real-time
customer facing
dashboards on
key performance
indicators
Call detail record
(CDR) &
extended data
record (XDR)
analysis
Supply chain
planning &
optimization
Smart meter
analytics
Data ingestion
and processing
Credit risk
assessment
Click fraud
detection
Understanding
customer
behavior AND
context
Preventive
maintenance
Reduce outages
& improve
resource
utilization
Predictive
analytics
Improve turn around
time of trade
settlement processes
Billing
optimization
Packaging and
selling
anonymous
customer data
Product quality &
defect tracking
Asset &
workforce
management
Data governance
• Large scale ingest and distribution
• Real-time ELTA (Extract Load Transform Analyze)
• Dimensional computation & aggregation
• Enforcing data quality and data governance requirements
• Real-time data enrichment with reference data
• Real-time machine learning model scoring
HORIZONTAL
Apache Apex
4
• In-memory, distributed stream processing
• Application logic broken into components (operators) that execute distributed in a cluster
• Unobtrusive Java API to express (custom) logic
• Maintain state and metrics in member variables
• Windowing, event-time processing
• Scalable, high throughput, low latency
• Operators can be scaled up or down at runtime according to the load and SLA
• Dynamic scaling (elasticity), compute locality
• Fault tolerance & correctness
• Automatically recover from node outages without having to reprocess from beginning
• State is preserved, checkpointing, incremental recovery
• End-to-end exactly-once
• Operability
• System and application metrics, record/visualize data
• Dynamic changes, elasticity
Native Hadoop Integration
5
• YARN is
the
resource
manager
• HDFS for
storing
persistent
state
Application Development Model
6
A Stream is a sequence of data
tuples
A typical Operator takes one or
more input streams, performs
computations & emits one or more
output streams
• Each Operator is YOUR custom
business logic in java, or built-in
operator from our open source
library
• Operator has many instances
that run in parallel and each
instance is single-threaded
Directed Acyclic Graph (DAG) is
made up of operators and streams
Directed Acyclic Graph (DAG)
Operator Operator
Operator
Operator
Operator Operator
Tuple
Output
Stream
Filtered
Stream
Enriched
Stream
Filtered
Stream
Enriched
Stream
Application Specification (Java)
7
Java Stream API (declarative)
DAG API (compositional)
Java Streams API + Windowing
8
Next Release (3.5): Support for Windowing à la Apache Beam (incubating):
@ApplicationAnnotation(name = "WordCountStreamingApiDemo")
public class ApplicationWithStreamAPI implements StreamingApplication
{
@Override
public void populateDAG(DAG dag, Configuration configuration)
{
String localFolder = "./src/test/resources/data";
ApexStream<String> stream = StreamFactory
.fromFolder(localFolder)
.flatMap(new Split())
.window(new WindowOption.GlobalWindow(), new
TriggerOption().withEarlyFiringsAtEvery(Duration.millis(1000)).accumulatingFiredPanes())
.countByKey(new ConvertToKeyVal()).print();
stream.populateDag(dag);
}
}
Writing an Operator
9
Operator Library
10
RDBMS
• Vertica
• MySQL
• Oracle
• JDBC
NoSQL
• Cassandra, Hbase
• Aerospike, Accumulo
• Couchbase/ CouchDB
• Redis, MongoDB
• Geode
Messaging
• Kafka
• Solace
• Flume, ActiveMQ
• Kinesis, NiFi
File Systems
• HDFS/ Hive
• NFS
• S3
Parsers
• XML
• JSON
• CSV
• Avro
• Parquet
Transformations
• Filters
• Rules
• Expression
• Dedup
• Enrich
Analytics
• Dimensional Aggregations
(with state management for
historical data + query)
Protocols
• HTTP
• FTP
• WebSocket
• MQTT
• SMTP
Other
• Elastic Search
• Script (JavaScript, Python, R)
• Solr
• Twitter
Stateful Processing
11
(All) : 5
t=4:00 : 2
t=5:00 : 3
k=A, t=4:00 : 2
k=A, t=5:00 : 1
k=B, t=5:00 : 2
(All) : 4
t=4:00 : 2
t=5:00 : 2
k=A, t=4:00 : 2
K=B, t=5:00 : 2
k=A
t=5:00
(All) : 1
t=4:00 : 1
k=A, t=4:00 : 1
k=B
t=5:59
k=B
t=5:00
k=A
T=4:30
k=A
t=4:00
State Checkpointing
12
 Distributed, asynchronous
 Periodic callbacks
 No artificial latency
 Pluggable storage
Fault Tolerance
13
• Operator state is checkpointed to persistent store
ᵒ Automatically performed by engine, no additional coding needed
ᵒ Asynchronous and distributed
ᵒ In case of failure operators are restarted from checkpoint state
• Automatic detection and recovery of failed containers
ᵒ Heartbeat mechanism
ᵒ YARN process status notification
• Buffering to enable replay of data from recovered point
ᵒ Fast, incremental recovery, spike handling
• Application master state checkpointed
ᵒ Snapshot of physical (and logical) plan
ᵒ Execution layer change log
• In-memory PubSub
• Stores results emitted by operator until committed
• Handles backpressure / spillover to local disk
• Ordering, idempotency
Operator
1
Container 1
Buffer
Server
Node 1
Operator
2
Container 2
Node 2
Buffer Server
14
Recovery Scenario
… EW2, 1, 3, BW2, EW1, 4, 2, 1, BW1
sum
0
… EW2, 1, 3, BW2, EW1, 4, 2, 1, BW1
sum
7
… EW2, 1, 3, BW2, EW1, 4, 2, 1, BW1
sum
10
… EW2, 1, 3, BW2, EW1, 4, 2, 1, BW1
sum
7
15
Processing Guarantees
16
At-least-once
• On recovery data will be replayed from a previous checkpoint
ᵒ No messages lost
ᵒ Default, suitable for most applications
• Can be used to ensure data is written once to store
ᵒ Transactions with meta information, Rewinding output, Feedback from
external entity, Idempotent operations
At-most-once
• On recovery the latest data is made available to operator
ᵒ Useful in use cases where some data loss is acceptable and latest data is
sufficient
Exactly-once
ᵒ At-least-once + idempotency + transactional mechanisms (operator logic) to
achieve end-to-end exactly once behavior
End-to-End Exactly Once
17
• Important when writing to external systems
• Data should not be duplicated or lost in the external system in case of
application failures
• Common external systems
ᵒ Databases
ᵒ Files
ᵒ Message queues
• Exactly-once = at-least-once + idempotency + consistent state
• Data duplication must be avoided when data is replayed from checkpoint
ᵒ Operators implement the logic dependent on the external system
ᵒ Platform provides checkpointing and repeatable windowing
Scalability
18
NxM PartitionsUnifier
0 1 2 3
Logical DAG
0 1 2
1
1 Unifier
1
20
Logical Diagram
Physical Diagram with operator 1 with 3 partitions
0
Unifier
1a
1b
1c
2a
2b
Unifier 3
Physical DAG with (1a, 1b, 1c) and (2a, 2b): No bottleneck
Unifier
Unifier0
1a
1b
1c
2a
2b
Unifier 3
Physical DAG with (1a, 1b, 1c) and (2a, 2b): Bottleneck on intermediate Unifier
Advanced Partitioning
19
0
1a
1b
2 3 4Unifier
Physical DAG
0 4
3a2a1a
1b 2b 3b
Unifier
Physical DAG with Parallel Partition
Parallel Partition
Container
uopr
uopr1
uopr2
uopr3
uopr4
uopr1
uopr2
uopr3
uopr4
dopr
dopr
doprunifier
unifier
unifier
unifier
Container
Container
NICNIC
NICNIC
NIC
Container
NIC
Logical Plan
Execution Plan, for N = 4; M = 1
Execution Plan, for N = 4; M = 1, K = 2 with cascading unifiers
Cascading Unifiers
0 1 2 3 4
Logical DAG
Dynamic Partitioning
20
• Partitioning change while application is running
ᵒ Change number of partitions at runtime based on stats
ᵒ Determine initial number of partitions dynamically
• Kafka operators scale according to number of kafka partitions
ᵒ Supports re-distribution of state when number of partitions change
ᵒ API for custom scaler or partitioner
2b
2c
3
2a
2d
1b
1a1a 2a
1b 2b
3
1a 2b
1b 2c 3b
2a
2d
3a
Unifiers not shown
How dynamic partitioning works
21
• Partitioning decision (yes/no) by trigger (StatsListener)
ᵒ Pluggable component, can use any system or custom metric
ᵒ Externally driven partitioning example: KafkaInputOperator
• Stateful!
ᵒ Uses checkpointed state
ᵒ Ability to transfer state from old to new partitions (partitioner, customizable)
ᵒ Steps:
• Call partitioner
• Modify physical plan, rewrite checkpoints as needed
• Undeploy old partitions from execution layer
• Release/request container resources
• Deploy new partitions (from rewritten checkpoint)
ᵒ No loss of data (buffered)
ᵒ Incremental operation, partitions that don’t change continue processing
• API: Partitioner interface
Compute Locality
22
• By default operators are deployed in containers (processes) on
different nodes across the Hadoop cluster
• Locality options for streams
ᵒ RACK_LOCAL: Data does not traverse network switches
ᵒ NODE_LOCAL: Data transfer via loopback interface, frees up network
bandwidth
ᵒ CONTAINER_LOCAL: Data transfer via in memory queues between
operators, does not require serialization
ᵒ THREAD_LOCAL: Data passed through call stack, operators share thread
• Host Locality
ᵒ Operators can be deployed on specific hosts
• New in 3.4.0: (Anti-)Affinity (APEXCORE-10)
ᵒ Ability to express relative deployment without specifying a host
Enterprise Tools
23
Monitoring Console
Logical View
24
Physical View
Real-Time Dashboards
25
Maximize Revenue w/ real-time insights
26
PubMatic is the leading marketing automation software company for publishers. Through real-time analytics,
yield management, and workflow automation, PubMatic enables publishers to make smarter inventory
decisions and improve revenue performance
Business Need Apex based Solution Client Outcome
• Ingest and analyze high volume clicks &
views in real-time to help customers
improve revenue
- 200K events/second data
flow
• Report critical metrics for campaign
monetization from auction and client
logs
- 22 TB/day data generated
• Handle ever increasing traffic with
efficient resource utilization
• Always-on ad network
• DataTorrent Enterprise platform,
powered by Apache Apex
• In-memory stream processing
• Comprehensive library of pre-built
operators including connectors
• Built-in fault tolerance
• Dynamically scalable
• Management UI & Data Visualization
console
• Helps PubMatic deliver ad performance
insights to publishers and advertisers in
real-time instead of 5+ hours
• Helps Publishers visualize campaign
performance and adjust ad inventory in
real-time to maximize their revenue
• Enables PubMatic reduce OPEX with
efficient compute resource utilization
• Built-in fault tolerance ensures
customers can always access ad
network
Industrial IoT applications
27
GE is dedicated to providing advanced IoT analytics solutions to thousands of customers who are using their
devices and sensors across different verticals. GE has built a sophisticated analytics platform, Predix, to help its
customers develop and execute Industrial IoT applications and gain real-time insights as well as actions.
Business Need Apex based Solution Client Outcome
• Ingest and analyze high-volume, high speed
data from thousands of devices, sensors
per customer in real-time without data loss
• Predictive analytics to reduce costly
maintenance and improve customer
service
• Unified monitoring of all connected sensors
and devices to minimize disruptions
• Fast application development cycle
• High scalability to meet changing business
and application workloads
• Ingestion application using DataTorrent
Enterprise platform
• Powered by Apache Apex
• In-memory stream processing
• Built-in fault tolerance
• Dynamic scalability
• Comprehensive library of pre-built
operators
• Management UI console
• Helps GE improve performance and lower
cost by enabling real-time Big Data
analytics
• Helps GE detect possible failures and
minimize unplanned downtimes with
centralized management & monitoring of
devices
• Enables faster innovation with short
application development cycle
• No data loss and 24x7 availability of
applications
• Helps GE adjust to scalability needs with
auto-scaling
Smart energy applications
28
Silver Spring Networks helps global utilities and cities connect, optimize, and manage smart energy and smart city
infrastructure. Silver Spring Networks receives data from over 22 million connected devices, conducts 2 million
remote operations per year
Business Need Apex based Solution Client Outcome
• Ingest high-volume, high speed data from
millions of devices & sensors in real-time
without data loss
• Make data accessible to applications
without delay to improve customer service
• Capture & analyze historical data to
understand & improve grid operations
• Reduce the cost, time, and pain of
integrating with 3rd party apps
• Centralized management of software &
operations
• DataTorrent Enterprise platform, powered
by Apache Apex
• In-memory stream processing
• Pre-built operator
• Built-in fault tolerance
• Dynamically scalable
• Management UI console
• Helps Silver Spring Networks ingest &
analyze data in real-time for effective load
management & customer service
• Helps Silver Spring Networks detect
possible failures and reduce outages with
centralized management & monitoring of
devices
• Enables fast application development for
faster time to market
• Helps Silver Spring Networks scale with
easy to partition operators
• Automatic recovery from failures
More about the use cases
29
• Pubmatic
• https://www.youtube.com/watch?v=JSXpgfQFcU8
• GE
• https://www.youtube.com/watch?v=hmaSkXhHNu0
• http://www.slideshare.net/ApacheApex/ge-iot-predix-time-series-data-ingestion-service-using-
apache-apex-hadoop
• SilverSpring Networks
• https://www.youtube.com/watch?v=8VORISKeSjI
• http://www.slideshare.net/ApacheApex/iot-big-data-ingestion-and-processing-in-hadoop-by-
silver-spring-networks
Q&A
30
Resources
31
• http://apex.apache.org/
• Learn more: http://apex.apache.org/docs.html
• Subscribe - http://apex.apache.org/community.html
• Download - http://apex.apache.org/downloads.html
• Follow @ApacheApex - https://twitter.com/apacheapex
• Meetups – http://www.meetup.com/pro/apacheapex/
• More examples: https://github.com/DataTorrent/examples
• Slideshare: http://www.slideshare.net/ApacheApex/presentations
• https://www.youtube.com/results?search_query=apache+apex
• Free Enterprise License for Startups -
https://www.datatorrent.com/product/startup-accelerator/

More Related Content

PPTX
DataTorrent Presentation @ Big Data Application Meetup
PPTX
Apache Big Data 2016: Next Gen Big Data Analytics with Apache Apex
PPTX
Hadoop Summit SJ 2016: Next Gen Big Data Analytics with Apache Apex
PPTX
Smart Partitioning with Apache Apex (Webinar)
PDF
Apex as yarn application
PPTX
Apache Apex Fault Tolerance and Processing Semantics
PPTX
IoT Ingestion & Analytics using Apache Apex - A Native Hadoop Platform
PPTX
Architectual Comparison of Apache Apex and Spark Streaming
DataTorrent Presentation @ Big Data Application Meetup
Apache Big Data 2016: Next Gen Big Data Analytics with Apache Apex
Hadoop Summit SJ 2016: Next Gen Big Data Analytics with Apache Apex
Smart Partitioning with Apache Apex (Webinar)
Apex as yarn application
Apache Apex Fault Tolerance and Processing Semantics
IoT Ingestion & Analytics using Apache Apex - A Native Hadoop Platform
Architectual Comparison of Apache Apex and Spark Streaming

What's hot (20)

PPTX
Introduction to Apache Apex
PPTX
Intro to Apache Apex (next gen Hadoop) & comparison to Spark Streaming
PDF
Introduction to Apache Apex - CoDS 2016
PPTX
Introduction to Apache Apex and writing a big data streaming application
PPTX
Intro to Apache Apex @ Women in Big Data
PDF
Building your first aplication using Apache Apex
PPTX
Intro to Apache Apex - Next Gen Native Hadoop Platform - Hackac
PPTX
Java High Level Stream API
PPTX
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
PPTX
Deep Dive into Apache Apex App Development
PPTX
Introduction to Apache Apex
PDF
Actionable Insights with Apache Apex at Apache Big Data 2017 by Devendra Tagare
PPTX
Fault Tolerance and Processing Semantics in Apache Apex
PDF
Apache Big Data EU 2016: Next Gen Big Data Analytics with Apache Apex
PDF
Developing streaming applications with apache apex (strata + hadoop world)
PDF
From Batch to Streaming with Apache Apex Dataworks Summit 2017
PPTX
Fault-Tolerant File Input & Output
PPTX
Ingestion and Dimensions Compute and Enrich using Apache Apex
PPTX
University program - writing an apache apex application
PDF
Low Latency Polyglot Model Scoring using Apache Apex
Introduction to Apache Apex
Intro to Apache Apex (next gen Hadoop) & comparison to Spark Streaming
Introduction to Apache Apex - CoDS 2016
Introduction to Apache Apex and writing a big data streaming application
Intro to Apache Apex @ Women in Big Data
Building your first aplication using Apache Apex
Intro to Apache Apex - Next Gen Native Hadoop Platform - Hackac
Java High Level Stream API
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
Deep Dive into Apache Apex App Development
Introduction to Apache Apex
Actionable Insights with Apache Apex at Apache Big Data 2017 by Devendra Tagare
Fault Tolerance and Processing Semantics in Apache Apex
Apache Big Data EU 2016: Next Gen Big Data Analytics with Apache Apex
Developing streaming applications with apache apex (strata + hadoop world)
From Batch to Streaming with Apache Apex Dataworks Summit 2017
Fault-Tolerant File Input & Output
Ingestion and Dimensions Compute and Enrich using Apache Apex
University program - writing an apache apex application
Low Latency Polyglot Model Scoring using Apache Apex
Ad

Viewers also liked (20)

PDF
Apache Apex as a YARN Apllication
PPSX
GE IOT Predix Time Series & Data Ingestion Service using Apache Apex (Hadoop)
PPTX
APEX TEC Presentation
PDF
Fllo a favor de o. bayer
PPT
святитель феофан в орле
PDF
BigDataSpain 2016: Stream Processing Applications with Apache Apex
PDF
Negocio Digital - Exemplo de Projeto - Cap. 2
PDF
Teoría celular...
PPT
Demandas contra el estado y la republica
PDF
Jennifer Mintzer Temple University Student Recommendations
PPTX
Southern2016
PDF
Tcpba. sala vi. bejarano maría reina. 29 12-16
PDF
Jennifer Mintzer Teaching Evaluations (Scantron Data)
PDF
Claves junio
PPTX
Arita Lazaro, Oscar Antonio Practica 5
PDF
KKCL_Juniors_Brochure
PDF
HIPAA
PPTX
ICRC2015slideshare
PDF
Masteroppgaven, Tom Erik Solstad
DOC
Trabajo sobre derecho financiero y derecho tributario
Apache Apex as a YARN Apllication
GE IOT Predix Time Series & Data Ingestion Service using Apache Apex (Hadoop)
APEX TEC Presentation
Fllo a favor de o. bayer
святитель феофан в орле
BigDataSpain 2016: Stream Processing Applications with Apache Apex
Negocio Digital - Exemplo de Projeto - Cap. 2
Teoría celular...
Demandas contra el estado y la republica
Jennifer Mintzer Temple University Student Recommendations
Southern2016
Tcpba. sala vi. bejarano maría reina. 29 12-16
Jennifer Mintzer Teaching Evaluations (Scantron Data)
Claves junio
Arita Lazaro, Oscar Antonio Practica 5
KKCL_Juniors_Brochure
HIPAA
ICRC2015slideshare
Masteroppgaven, Tom Erik Solstad
Trabajo sobre derecho financiero y derecho tributario
Ad

Similar to Apache Apex: Stream Processing Architecture and Applications (20)

PDF
Introduction to Apache Apex by Thomas Weise
PDF
BigDataSpain 2016: Introduction to Apache Apex
PPTX
Next Gen Big Data Analytics with Apache Apex
PPTX
Big Data Berlin v8.0 Stream Processing with Apache Apex
PPTX
Thomas Weise, Apache Apex PMC Member and Architect/Co-Founder, DataTorrent - ...
PPTX
Stream data from Apache Kafka for processing with Apache Apex
PPTX
Apache Apex Fault Tolerance and Processing Semantics
PPTX
February 2017 HUG: Exactly-once end-to-end processing with Apache Apex
PPTX
Flexible and Real-Time Stream Processing with Apache Flink
PDF
Inside Kafka Streams—Monitoring Comcast’s Outside Plant
PDF
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
PDF
Stream Processing Overview
PPTX
Flink Streaming @BudapestData
PDF
Apache Pulsar Overview
PDF
Real-time Stream Processing using Apache Apex
PPTX
Apache Apex - Hadoop Users Group
PPTX
February 2016 HUG: Apache Apex (incubating): Stream Processing Architecture a...
PPTX
Stream Processing with Apache Apex
PDF
SAND: A Fault-Tolerant Streaming Architecture for Network Traffic Analytics
PPTX
Project Slides for Website 2020-22.pptx
Introduction to Apache Apex by Thomas Weise
BigDataSpain 2016: Introduction to Apache Apex
Next Gen Big Data Analytics with Apache Apex
Big Data Berlin v8.0 Stream Processing with Apache Apex
Thomas Weise, Apache Apex PMC Member and Architect/Co-Founder, DataTorrent - ...
Stream data from Apache Kafka for processing with Apache Apex
Apache Apex Fault Tolerance and Processing Semantics
February 2017 HUG: Exactly-once end-to-end processing with Apache Apex
Flexible and Real-Time Stream Processing with Apache Flink
Inside Kafka Streams—Monitoring Comcast’s Outside Plant
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
Stream Processing Overview
Flink Streaming @BudapestData
Apache Pulsar Overview
Real-time Stream Processing using Apache Apex
Apache Apex - Hadoop Users Group
February 2016 HUG: Apache Apex (incubating): Stream Processing Architecture a...
Stream Processing with Apache Apex
SAND: A Fault-Tolerant Streaming Architecture for Network Traffic Analytics
Project Slides for Website 2020-22.pptx

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Review of recent advances in non-invasive hemoglobin estimation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Digital-Transformation-Roadmap-for-Companies.pptx
cuic standard and advanced reporting.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation_ Review paper, used for researhc scholars
Building Integrated photovoltaic BIPV_UPV.pdf
Machine learning based COVID-19 study performance prediction
Understanding_Digital_Forensics_Presentation.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Spectral efficient network and resource selection model in 5G networks
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Diabetes mellitus diagnosis method based random forest with bat algorithm
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Apache Apex: Stream Processing Architecture and Applications

  • 1. Apache Apex: Stream Processing Architecture and Applications Thomas Weise <[email protected]> @thweise Spark & Hadoop User Group Munich, July 19th 2016
  • 2. Stream Data Processing 2 Data Sources Events Logs Sensor Data Social Databases CDC Oper1 Oper2 Oper3 Real-time analytics on data in motion Data Visualization
  • 3. Industries & Use Cases 3 Financial Services Ad-Tech Telecom Manufacturing Energy IoT Fraud and risk monitoring Real-time customer facing dashboards on key performance indicators Call detail record (CDR) & extended data record (XDR) analysis Supply chain planning & optimization Smart meter analytics Data ingestion and processing Credit risk assessment Click fraud detection Understanding customer behavior AND context Preventive maintenance Reduce outages & improve resource utilization Predictive analytics Improve turn around time of trade settlement processes Billing optimization Packaging and selling anonymous customer data Product quality & defect tracking Asset & workforce management Data governance • Large scale ingest and distribution • Real-time ELTA (Extract Load Transform Analyze) • Dimensional computation & aggregation • Enforcing data quality and data governance requirements • Real-time data enrichment with reference data • Real-time machine learning model scoring HORIZONTAL
  • 4. Apache Apex 4 • In-memory, distributed stream processing • Application logic broken into components (operators) that execute distributed in a cluster • Unobtrusive Java API to express (custom) logic • Maintain state and metrics in member variables • Windowing, event-time processing • Scalable, high throughput, low latency • Operators can be scaled up or down at runtime according to the load and SLA • Dynamic scaling (elasticity), compute locality • Fault tolerance & correctness • Automatically recover from node outages without having to reprocess from beginning • State is preserved, checkpointing, incremental recovery • End-to-end exactly-once • Operability • System and application metrics, record/visualize data • Dynamic changes, elasticity
  • 5. Native Hadoop Integration 5 • YARN is the resource manager • HDFS for storing persistent state
  • 6. Application Development Model 6 A Stream is a sequence of data tuples A typical Operator takes one or more input streams, performs computations & emits one or more output streams • Each Operator is YOUR custom business logic in java, or built-in operator from our open source library • Operator has many instances that run in parallel and each instance is single-threaded Directed Acyclic Graph (DAG) is made up of operators and streams Directed Acyclic Graph (DAG) Operator Operator Operator Operator Operator Operator Tuple Output Stream Filtered Stream Enriched Stream Filtered Stream Enriched Stream
  • 7. Application Specification (Java) 7 Java Stream API (declarative) DAG API (compositional)
  • 8. Java Streams API + Windowing 8 Next Release (3.5): Support for Windowing à la Apache Beam (incubating): @ApplicationAnnotation(name = "WordCountStreamingApiDemo") public class ApplicationWithStreamAPI implements StreamingApplication { @Override public void populateDAG(DAG dag, Configuration configuration) { String localFolder = "./src/test/resources/data"; ApexStream<String> stream = StreamFactory .fromFolder(localFolder) .flatMap(new Split()) .window(new WindowOption.GlobalWindow(), new TriggerOption().withEarlyFiringsAtEvery(Duration.millis(1000)).accumulatingFiredPanes()) .countByKey(new ConvertToKeyVal()).print(); stream.populateDag(dag); } }
  • 10. Operator Library 10 RDBMS • Vertica • MySQL • Oracle • JDBC NoSQL • Cassandra, Hbase • Aerospike, Accumulo • Couchbase/ CouchDB • Redis, MongoDB • Geode Messaging • Kafka • Solace • Flume, ActiveMQ • Kinesis, NiFi File Systems • HDFS/ Hive • NFS • S3 Parsers • XML • JSON • CSV • Avro • Parquet Transformations • Filters • Rules • Expression • Dedup • Enrich Analytics • Dimensional Aggregations (with state management for historical data + query) Protocols • HTTP • FTP • WebSocket • MQTT • SMTP Other • Elastic Search • Script (JavaScript, Python, R) • Solr • Twitter
  • 11. Stateful Processing 11 (All) : 5 t=4:00 : 2 t=5:00 : 3 k=A, t=4:00 : 2 k=A, t=5:00 : 1 k=B, t=5:00 : 2 (All) : 4 t=4:00 : 2 t=5:00 : 2 k=A, t=4:00 : 2 K=B, t=5:00 : 2 k=A t=5:00 (All) : 1 t=4:00 : 1 k=A, t=4:00 : 1 k=B t=5:59 k=B t=5:00 k=A T=4:30 k=A t=4:00
  • 12. State Checkpointing 12  Distributed, asynchronous  Periodic callbacks  No artificial latency  Pluggable storage
  • 13. Fault Tolerance 13 • Operator state is checkpointed to persistent store ᵒ Automatically performed by engine, no additional coding needed ᵒ Asynchronous and distributed ᵒ In case of failure operators are restarted from checkpoint state • Automatic detection and recovery of failed containers ᵒ Heartbeat mechanism ᵒ YARN process status notification • Buffering to enable replay of data from recovered point ᵒ Fast, incremental recovery, spike handling • Application master state checkpointed ᵒ Snapshot of physical (and logical) plan ᵒ Execution layer change log
  • 14. • In-memory PubSub • Stores results emitted by operator until committed • Handles backpressure / spillover to local disk • Ordering, idempotency Operator 1 Container 1 Buffer Server Node 1 Operator 2 Container 2 Node 2 Buffer Server 14
  • 15. Recovery Scenario … EW2, 1, 3, BW2, EW1, 4, 2, 1, BW1 sum 0 … EW2, 1, 3, BW2, EW1, 4, 2, 1, BW1 sum 7 … EW2, 1, 3, BW2, EW1, 4, 2, 1, BW1 sum 10 … EW2, 1, 3, BW2, EW1, 4, 2, 1, BW1 sum 7 15
  • 16. Processing Guarantees 16 At-least-once • On recovery data will be replayed from a previous checkpoint ᵒ No messages lost ᵒ Default, suitable for most applications • Can be used to ensure data is written once to store ᵒ Transactions with meta information, Rewinding output, Feedback from external entity, Idempotent operations At-most-once • On recovery the latest data is made available to operator ᵒ Useful in use cases where some data loss is acceptable and latest data is sufficient Exactly-once ᵒ At-least-once + idempotency + transactional mechanisms (operator logic) to achieve end-to-end exactly once behavior
  • 17. End-to-End Exactly Once 17 • Important when writing to external systems • Data should not be duplicated or lost in the external system in case of application failures • Common external systems ᵒ Databases ᵒ Files ᵒ Message queues • Exactly-once = at-least-once + idempotency + consistent state • Data duplication must be avoided when data is replayed from checkpoint ᵒ Operators implement the logic dependent on the external system ᵒ Platform provides checkpointing and repeatable windowing
  • 18. Scalability 18 NxM PartitionsUnifier 0 1 2 3 Logical DAG 0 1 2 1 1 Unifier 1 20 Logical Diagram Physical Diagram with operator 1 with 3 partitions 0 Unifier 1a 1b 1c 2a 2b Unifier 3 Physical DAG with (1a, 1b, 1c) and (2a, 2b): No bottleneck Unifier Unifier0 1a 1b 1c 2a 2b Unifier 3 Physical DAG with (1a, 1b, 1c) and (2a, 2b): Bottleneck on intermediate Unifier
  • 19. Advanced Partitioning 19 0 1a 1b 2 3 4Unifier Physical DAG 0 4 3a2a1a 1b 2b 3b Unifier Physical DAG with Parallel Partition Parallel Partition Container uopr uopr1 uopr2 uopr3 uopr4 uopr1 uopr2 uopr3 uopr4 dopr dopr doprunifier unifier unifier unifier Container Container NICNIC NICNIC NIC Container NIC Logical Plan Execution Plan, for N = 4; M = 1 Execution Plan, for N = 4; M = 1, K = 2 with cascading unifiers Cascading Unifiers 0 1 2 3 4 Logical DAG
  • 20. Dynamic Partitioning 20 • Partitioning change while application is running ᵒ Change number of partitions at runtime based on stats ᵒ Determine initial number of partitions dynamically • Kafka operators scale according to number of kafka partitions ᵒ Supports re-distribution of state when number of partitions change ᵒ API for custom scaler or partitioner 2b 2c 3 2a 2d 1b 1a1a 2a 1b 2b 3 1a 2b 1b 2c 3b 2a 2d 3a Unifiers not shown
  • 21. How dynamic partitioning works 21 • Partitioning decision (yes/no) by trigger (StatsListener) ᵒ Pluggable component, can use any system or custom metric ᵒ Externally driven partitioning example: KafkaInputOperator • Stateful! ᵒ Uses checkpointed state ᵒ Ability to transfer state from old to new partitions (partitioner, customizable) ᵒ Steps: • Call partitioner • Modify physical plan, rewrite checkpoints as needed • Undeploy old partitions from execution layer • Release/request container resources • Deploy new partitions (from rewritten checkpoint) ᵒ No loss of data (buffered) ᵒ Incremental operation, partitions that don’t change continue processing • API: Partitioner interface
  • 22. Compute Locality 22 • By default operators are deployed in containers (processes) on different nodes across the Hadoop cluster • Locality options for streams ᵒ RACK_LOCAL: Data does not traverse network switches ᵒ NODE_LOCAL: Data transfer via loopback interface, frees up network bandwidth ᵒ CONTAINER_LOCAL: Data transfer via in memory queues between operators, does not require serialization ᵒ THREAD_LOCAL: Data passed through call stack, operators share thread • Host Locality ᵒ Operators can be deployed on specific hosts • New in 3.4.0: (Anti-)Affinity (APEXCORE-10) ᵒ Ability to express relative deployment without specifying a host
  • 26. Maximize Revenue w/ real-time insights 26 PubMatic is the leading marketing automation software company for publishers. Through real-time analytics, yield management, and workflow automation, PubMatic enables publishers to make smarter inventory decisions and improve revenue performance Business Need Apex based Solution Client Outcome • Ingest and analyze high volume clicks & views in real-time to help customers improve revenue - 200K events/second data flow • Report critical metrics for campaign monetization from auction and client logs - 22 TB/day data generated • Handle ever increasing traffic with efficient resource utilization • Always-on ad network • DataTorrent Enterprise platform, powered by Apache Apex • In-memory stream processing • Comprehensive library of pre-built operators including connectors • Built-in fault tolerance • Dynamically scalable • Management UI & Data Visualization console • Helps PubMatic deliver ad performance insights to publishers and advertisers in real-time instead of 5+ hours • Helps Publishers visualize campaign performance and adjust ad inventory in real-time to maximize their revenue • Enables PubMatic reduce OPEX with efficient compute resource utilization • Built-in fault tolerance ensures customers can always access ad network
  • 27. Industrial IoT applications 27 GE is dedicated to providing advanced IoT analytics solutions to thousands of customers who are using their devices and sensors across different verticals. GE has built a sophisticated analytics platform, Predix, to help its customers develop and execute Industrial IoT applications and gain real-time insights as well as actions. Business Need Apex based Solution Client Outcome • Ingest and analyze high-volume, high speed data from thousands of devices, sensors per customer in real-time without data loss • Predictive analytics to reduce costly maintenance and improve customer service • Unified monitoring of all connected sensors and devices to minimize disruptions • Fast application development cycle • High scalability to meet changing business and application workloads • Ingestion application using DataTorrent Enterprise platform • Powered by Apache Apex • In-memory stream processing • Built-in fault tolerance • Dynamic scalability • Comprehensive library of pre-built operators • Management UI console • Helps GE improve performance and lower cost by enabling real-time Big Data analytics • Helps GE detect possible failures and minimize unplanned downtimes with centralized management & monitoring of devices • Enables faster innovation with short application development cycle • No data loss and 24x7 availability of applications • Helps GE adjust to scalability needs with auto-scaling
  • 28. Smart energy applications 28 Silver Spring Networks helps global utilities and cities connect, optimize, and manage smart energy and smart city infrastructure. Silver Spring Networks receives data from over 22 million connected devices, conducts 2 million remote operations per year Business Need Apex based Solution Client Outcome • Ingest high-volume, high speed data from millions of devices & sensors in real-time without data loss • Make data accessible to applications without delay to improve customer service • Capture & analyze historical data to understand & improve grid operations • Reduce the cost, time, and pain of integrating with 3rd party apps • Centralized management of software & operations • DataTorrent Enterprise platform, powered by Apache Apex • In-memory stream processing • Pre-built operator • Built-in fault tolerance • Dynamically scalable • Management UI console • Helps Silver Spring Networks ingest & analyze data in real-time for effective load management & customer service • Helps Silver Spring Networks detect possible failures and reduce outages with centralized management & monitoring of devices • Enables fast application development for faster time to market • Helps Silver Spring Networks scale with easy to partition operators • Automatic recovery from failures
  • 29. More about the use cases 29 • Pubmatic • https://www.youtube.com/watch?v=JSXpgfQFcU8 • GE • https://www.youtube.com/watch?v=hmaSkXhHNu0 • http://www.slideshare.net/ApacheApex/ge-iot-predix-time-series-data-ingestion-service-using- apache-apex-hadoop • SilverSpring Networks • https://www.youtube.com/watch?v=8VORISKeSjI • http://www.slideshare.net/ApacheApex/iot-big-data-ingestion-and-processing-in-hadoop-by- silver-spring-networks
  • 31. Resources 31 • http://apex.apache.org/ • Learn more: http://apex.apache.org/docs.html • Subscribe - http://apex.apache.org/community.html • Download - http://apex.apache.org/downloads.html • Follow @ApacheApex - https://twitter.com/apacheapex • Meetups – http://www.meetup.com/pro/apacheapex/ • More examples: https://github.com/DataTorrent/examples • Slideshare: http://www.slideshare.net/ApacheApex/presentations • https://www.youtube.com/results?search_query=apache+apex • Free Enterprise License for Startups - https://www.datatorrent.com/product/startup-accelerator/