intro to apache apex, the next gen hadoop platform for ingestion & transformation
TRANSCRIPT
Introduction to Apache Apex
Dr. Munagala RamanathSoftware Engineer & Apex
Committer
© 2015 DataTorrent
Resources
2
Apache Apex Community Page
Apache Apex LinkedIn Group
www.ApexBigData.com
3
Stream Processing
•Data from variety of sources (IoT, Kafka, files, social media etc.)
•Unbounded, continuous data streams•Batch can be processed as stream (but a stream is not a batch)
•(In-memory) Processing with temporal boundaries (windows)
•Stateful operations: Aggregation, Rules, … -> Analytics
•Results stored to variety of sinks or destinations•Streaming application can also serve data with very low latency
Browser
Web Server
Kafka Input(logs)
Decompress, Parse, Filter
Dimensions Aggregate Kafka
LogsKafka
4
Apache Apex
•In-memory, distributed stream processing•Application logic broken into components called operators that run in a distributed fashion across your cluster
•Natural programming model•Unobtrusive Java API to express (custom) logic
•Maintain state and metrics in your member variables
•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
Apache Apex and DataTorrent Product StackDesigned to help you at every stage of your data-in-motion pipeline
Solutions for Business Problems
Ingestion & Data Prep ETL Pipelines
Ease of Use Tools Real-Time Data VisualizationManagement & MonitoringGUI Application Assembly
Application Templates
Apex-Malhar Operator Library
Big Data Infrastructure Hadoop 2.x – YARN + HDFS – On Prem & Cloud
Core
High-level APITransformation ML & Score SQL Analytics
FileSync
Dev Framework Batch Support
Apache Apex Core
Kafka HDFS HDFS HDFS JDBC HDFS JDBC Kafka
6
Application Development Model
▪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)
Filtered
Stream
Output StreamTuple Tuple
Filtered Stream
Enriched Stream
Enriched
Stream
er
Operator
er
Operator
er
Operator
er
Operator
er
Operator
er
Operator
7
Native Hadoop Integration
• YARN is the resource manager
• HDFS for storing persistent state
8
Sample Application
KafkaInput
Parser
WordCount
er
Database
Output
CountsWordsLinesKafka DatabaseApex Application
• Design and develop operators or use existing ones from the library• Connect operators to form an Application• Configure operators• Configure scaling and other platform attributes• Test functionality, performance and iterate
Filter
Filtered
Apex Malhar - Production Ready Operators
RDBMS• Vertica• MySQL• Oracle• JDBC
NoSQL• Cassandra• Hbase• MongoDB• Aerospike, Accumulo• Couchbase/ CouchDB• Redis
Messaging• Kafka• Solace• Flume• ActiveMQ• Kinesis
File Systems• HDFS/ Hive• NFS• S3
Parsers• XML • JSON• CSV• Avro• Parquet
Transformations• Filters• Rules• Expression• Dedup• Enrich
Analytics• Dimensional Aggregations
Protocols• HTTP• FTP• WebSocket• MQTT• SMTP
Other• Elastic Search• Script (JavaScript, Python,
R)• Geode• Nifi• Twitter
Operator Maturity Framework
Scalability and Idempotency
Documentation
Example Applications
Internal Certification
Benchmarking
10
Filter Operator
11
Application Definition
Instantiate operators Connect operators by connecting output port to input port
• Multiple ways• Compositional, High Level with Windowing, Beam, Stream SQL, JSON, Property file
• Compositional example
12
Scalability
0Unifier
1a
1b
1c
2a
2b
Unifier
3
Unifier
0 4
3a
2a
1a
1b
2b
3b
Unifier
uopr1uopr2uopr3uopr4
dopr
unifier
unifier
unifier
Container
Container
NIC
NIC
NIC
NIC
NIC
Container
Partitioning & Unification
Cascade Unifier
Parallel Partitioning
13
Dynamic Scaling
• 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 redistribution 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
14
Runtime topology
15
Fault Tolerance & Checkpointing
▪ Application window ▪ Sliding window and tumbling window▪ Checkpoint window▪ No artificial latency
• In-memory PubSub
• Stores results emitted by operator until committed
• Handles backpressure / spillover to local disk
• Ordering, idempotency
Operator 1
Container 1
BufferServer
Node 1
Operator 2
Container 2
Node 2
Buffer Server
16
17
End-to-End Exactly Once
•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
Monitoring Console
•Logical View Physical View
19
Real-Time Dashboards
Application Designer
AppHub – App Template Repository
• Application repository that serves demos and applications that are backed by DataTorrent
• Provides version updates via dtManage
•Future Opportunities• Apps on Cloud Big Data
environments such as Azure, EMR
• Marketplace for applications created by the community
GE powers Industrial IoT applications with DataTorrent
18 | © 2016 DataTorrent Confidential – Do Not Distribute
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 DataTorrent 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
• Built an 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 including connectors• Management UI console
• Helps GE improve performance and lower costs
• Helps GE detect possible failures and minimize unplanned downtimes with easy, centralized management & monitoring of devices
• Enables faster innovation with short application development cycle
• No data loss and 24x7 availability of applications
• Helps GE easily adjust to scalability needs with auto-scaling
CapitalOne prevents fraudulent credit card transactions in real-time with DataTorrent
18 | © 2016 DataTorrent Confidential – Do Not Distribute
Capital One is the eighth-largest bank holding company in the US and specializes in credit cards, home loans, auto loans, banking and savings products. It is using Apache Apex to build their next generation decisioning platform, achieving an ultra-low latency of under 2 ms for decision making, and handling 2,000 events burst at a net rate of 70,000 events/sec.
Business Need DataTorrent Solution
• Replaces existing mainframe system for CapitalOne
• No data loss and 24x7 availability of applications
• Easy integration with the existing infrastructure HDFS, messaging queues & in-memory data grids
• Achieved 0.25 ms latency (on average), 2 ms latency (99.99%), 16 ms (99.9999).
Client Outcome
• Decline fraudulent credit card transactions• Open Source • Decision to authorize or decline a
transaction in real time - SLA is 40 ms (ideally 15 ms)
• Process 2,000 events/ 10ms• Transactions may be declined based on
• a transaction attribute or several attributes &
• dynamically changing rules (e.g. an account is disabled or an account limit is reached)
• DataTorrent 2.0 Enterprise platform, powered by Apache Apex
• In-memory stream processing • Comprehensive library of pre-built
operators including connectors• The only enterprise ready solution• Built-in fault tolerance• Dynamically scalable• Use precomputed ML model for
scoring• Management UI & Data Visualization
console
24
Resources for the use cases
•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
25
Resources• Apache Apex - http://apex.apache.org/
• Subscribe to forums
○ Apex - http://apex.apache.org/community.html
○ DataTorrent - https://groups.google.com/forum/#!forum/dt-users
• Download - https://datatorrent.com/download/
• Twitter○ @ApacheApex; Follow - https://twitter.com/apacheapex○ @DataTorrent; Follow – https://twitter.com/datatorrent
• Meetups - http://meetup.com/topics/apache-apex
• Webinars - https://datatorrent.com/webinars/
• Videos - https://youtube.com/user/DataTorrent
• Slides - http://slideshare.net/DataTorrent/presentations
• Startup Accelerator Program - Full featured enterprise product○ https://datatorrent.com/product/startup-accelerator/
• Big Data Application Templates Hub – https://datatorrent.com/apphub
26
We Are Hiring• [email protected]
• Developers/Architects
• QA Automation Developers
• Information Developers
• Build and Release
• Community Leaders
27
Q&A
Thank you
EXTRA
Application Specification (Java)
29
Java Stream API (declarative)
DAG API (compositional)
Writing an Operator
30
Attributes
31
• Attributes are platform features and apply to all operators