SlideShare a Scribd company logo
1 of 22
Download to read offline
XStream - A Planetary Scale Stream
Processing Platform at Facebook
Shuyi Chen
Software Engineer
Committer of Apache Flink
& Calcite
Aniket Mokashi
Engineering Manager
PMC of Apache Pig & Parquet
PHOTO
Agenda
● Stream processing use cases
● Brief history of real-time data processing at Facebook
● Introduction to XStream
● XStream Design Principles
○ Stylus (C++)
○ CoreSQL - Single Dialect across Engines
○ Interpretive execution
○ Vectorized Execution
Stream Processing at Facebook
Streaming Data Flow at FB
High Availability and Low Latency are important to our business
Devices
Web
Others
Event Producers
Messaging Pipe = Scribe
Stream Processing
Pipelines
Warehouse, for
retention and
complex queries
Scribe,
messaging
bus
Publish / Serve
Scuba for quick
analytics and
troubleshooting
Services
A typical streaming data flow...
Use Cases @ Facebook
Diversity of Use Cases
• Time series analytics – calculate
metrics over time windows and
stream to another Scribe category,
dashboard or Scuba
• Real time dashboards/Scuba –
aggregate and process Scribe to
feed dashboards or another Scribe
category
• Real time metrics – Custom metrics
or triggers for real time monitoring,
notifications or alarms
Stream Analytics
• Clean, enrich, organize, and
transform raw Scribe prior to
loading to warehouse reducing or
eliminating batch ETL steps
• Common built-in operators to
transform, aggregate, and filter
streaming data
• Enable various stages of the
ML life cycle E.g., feature
engineering
• Enable predictive analytics,
fraud detection, real-time
personalization, and other
advanced analytics use cases
Stream Transform Real-Time AI/ML
Stream Processing Ecosystem
Read more:
Realtime Data Processing at Facebook
LogDevice · Distributed storage for sequential data
A look at the history
Scribe
Persistent,
distributed
messaging
system
Fully Managed
Stream
Processing
service -
Authored in a
SQL like
language with
UDFs written in
Java
Puma Swift
Simplistic
Stream
processing
library -
Authored in
Python
Stylus
Low level stream
processing
framework in
C++
Laser
Key-value store
on top of
RocksDB for
lookup joins
Scuba
Slice-and-dice
analysis data
store
Stream Processing Ecosystem
https://research.fb.com/wp-content/uploads/2016/11/realtime_data_processing_at_facebook.pdf
A look at the history
Overwhelmed
Customers
Overwhelmed
Team
Stream Processing Ecosystem
Too many
choices
Fast forward 2018-2020
Stream Processing Ecosystem Goals
Then..
● Move Fast
● Ease of use, deployment and debugging
● Monitoring and operations
Now..
● Move fast with stable infrastructure
● Consistent use - low cognitive overhead
● Performance at Scale
● Consolidation
● Intelligent monitoring and low operational costs
Evolution from then to now
XStream
One Unified “Fully Managed” Stream Processing Platform
Enable customers to build applications that can react to
events in real-time, produce analytics at source and
minimize the data to insights and actioning cycle.
Mission
Why not open source?
On-Prem and Cloud Services Comparison
Auto
Scaling
Load
Balance
Privacy &
Security
Data
Quality
SQL Relational
API
Functional
API
Apache Flink No No No No Flink SQL Flink Table API DataStream
Spark
Streaming
Yes Yes No Deequ
(AWS)
Spark SQL Spark Dataset RDD
Apache Samza Yes
(manual)
Yes No No Samza SQL No Samza
High-level API
Apache Beam Yes Yes No No Beam SQL No PTransform
API
AWS Kinesis
Analytics
Yes Yes Yes No
ANSI 2008 with
extensions
Yes Table API No
Google Cloud
DataFlow
Yes Yes Yes
No (Trifacta
for upfront)
SQL like
non-compliant
Yes No
XStream
Yes Yes Yes No CoreSQL SQL
2016 with
extensions
Fluent API Stylus
functional
XStream Overview
• Accelerate Developer Velocity
- Just write business logic and let us manage everything else - Important at FB Scale
- Even more important so developers don’t just focus on KTLO
- Authoring ease / Write once, run many with one SQL dialect shared across batch,
interactive and streaming use cases
• Efficiency and Performance
- ~2x more efficient than predecessor and tighter integration with Native C++ engine
• Fully Managed Service
- No need to worry about scaling, backups, patching etc.
- Managed platform means low ops load and scaling on demand to 10s of thousands of
jobs
Planetary Scale Fully Managed Event Processing System
Why XStream?
XStream Engine Overview
• Stylus C++ framework
• Design principles
• Performance study
Query Planner & Optimizer
Language
SQL & DataFrame
Query Runtime
Stylus
XStream Engine Overview
● Stylus is a distributed fault-tolerant & scalable stream processing engine at FB
○ Sources/sinks
○ Operators
○ Watermark
○ Checkpoint
○ Trigger & timer
○ State backend
● However
○ It has steep learning curve
○ High maintenance and operational cost
Stylus C++ framework
XStream Engine Overview
• We built XStream with C++ on top of the stylus stream processing framework
• We use a common SQL dialect as Spark & Presto
• We adopt interpretation over up-front compilation
• We build & share the vectorized SQL evaluation engine with Presto & Spark
Principles
XStream Engine Overview
• C++ based Stylus stream processing framework is mature & widely used in FB
• Java support is very limited in FB
• Many service backend & business logic are written in C++
• Efficiency & performance is an important factor
Why C++ for XStream?
CoreSQL
A single dialect for all SQLs in FB
• Offer a single SQL dialect and framework across different tools in FB
• Modernize Presto SQL language with SQL 2016 standard
• Makes moving between different engines easy based off use cases
• Bring other extensions from Streaming, and Graph SQL into this modernized Presto SQL
language.
• Enable UDFs portability across engines
• Open source
XStream integrate CoreSQL by implementing the streaming extension support
• Tumbling window with multi window support
• Sliding window with multi slide & multi window support
• Session window
A common SQL dialects across FB
Query Execution (C++)
Up-front compilation
• Planner codegen entire C++ pipeline and
compiles into machine code
- Highly optimized code
• However,
- One binary per pipeline
- Hard to scale operationally
- Reliability concern
- Long build time → low dev efficiency
SELECT SUM(action), type
FROM action_by_type
GROUP BY type
Main.cpp:
from(“action_by_type”)
-> map(...)
-> keyBy(“type”)
->aggregate(“sum(action)”)
->toSink(...)
XStream/Stylus
C++ libraries
Binary
Compile & build
Deploy
Query Execution
Interpretation
• Planner generate distributed execution plan
and each C++ worker node interpret the
local plan and execute interpretively.
- No build process needed
- Single engine binary for all pipelines
- Easier to scale operationally
• However, to achieve high
efficiency/performance, interpretation
usually use vector-at-a-time processing on
columnar data representation
- Amortize interpretation overhead
- Hide cache miss latency
- Leverage SIMD support
SELECT SUM(action), type
FROM action_by_type
GROUP BY type
Execution Plan as JSON:
XStreamSource(“action_by_type”)
→ XStreamCalc()
→
XStreamWindowAggregate(“sum(
action)”)
→ XStreamSink(...)
Deploy
Turbine
Engine
Binary
Weekly
release
manage
d by
XStrea
m
Velox Overview
New C++ vectorized SQL evaluation engine
Provide universal and state-of-art building blocks for compute
Why?
• Efficiency and Latency
• Consistency
• Reusability and Engineering Efficiency
Goal is to unify eval engines across FB & beyond
• Presto
• Spark
• XStream
• Etc.
Already Open source!
Task, driver
Operators
Expression evaluation
Vectors
XStream Engine Stack
Query Planner
Logical plan Physical plan
XStream local planner
XStream Query Runtime
Velox Expression
evaluation
Velox Vectors
XStream Columnar
Source/Sinks/Operators
Stylus framework
CoreSQL Dataframe
XStream local planner
XStream Query Runtime
Stylus framework
Performance
• Velox (cpp vs java)
- 2-10x CPU improvements in initial subset of Presto interactive workload evaluated
• XStream stateless workload (interpretive vs compiled)
- With ~100 events of micro-batching, interpretation performs ~ as compilation with
10%-30% memory saving during normal processing
- During catching up lag, interpretation beat compilation by 30-50% in throughput with
same CPU and slightly less memory usage
Planetary Scale Stream Processing - The Future
We’re just getting started - Two flavors, one for platform and the other for long-tail!
• Fully Managed Service
- Both PaaS and SaaS
- Full SQL support
- Advanced Streaming Systems
features eg - backfill support
- Cost based optimizer
• Build a portable UDF ecosystem.
Common UDFs that run across FB’s
Data Infrastructure
• Come join us!

More Related Content

What's hot

Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaJiangjie Qin
 
Presto Summit 2018 - 09 - Netflix Iceberg
Presto Summit 2018  - 09 - Netflix IcebergPresto Summit 2018  - 09 - Netflix Iceberg
Presto Summit 2018 - 09 - Netflix Icebergkbajda
 
How Adobe Does 2 Million Records Per Second Using Apache Spark!
How Adobe Does 2 Million Records Per Second Using Apache Spark!How Adobe Does 2 Million Records Per Second Using Apache Spark!
How Adobe Does 2 Million Records Per Second Using Apache Spark!Databricks
 
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...DataWorks Summit
 
CDC Stream Processing With Apache Flink With Timo Walther | Current 2022
CDC Stream Processing With Apache Flink With Timo Walther | Current 2022CDC Stream Processing With Apache Flink With Timo Walther | Current 2022
CDC Stream Processing With Apache Flink With Timo Walther | Current 2022HostedbyConfluent
 
ksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database SystemksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database Systemconfluent
 
Autoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeAutoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeFlink Forward
 
Apache Flink 101 - the rise of stream processing and beyond
Apache Flink 101 - the rise of stream processing and beyondApache Flink 101 - the rise of stream processing and beyond
Apache Flink 101 - the rise of stream processing and beyondBowen Li
 
Making Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta LakeMaking Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta LakeDatabricks
 
Elastic Stack Introduction
Elastic Stack IntroductionElastic Stack Introduction
Elastic Stack IntroductionVikram Shinde
 
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...Databricks
 
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드confluent
 
A Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiA Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiDatabricks
 
Improving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at UberImproving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at UberYing Zheng
 
Evening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in FlinkEvening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in FlinkFlink Forward
 
A Practical Enterprise Feature Store on Delta Lake
A Practical Enterprise Feature Store on Delta LakeA Practical Enterprise Feature Store on Delta Lake
A Practical Enterprise Feature Store on Delta LakeDatabricks
 
Building an open data platform with apache iceberg
Building an open data platform with apache icebergBuilding an open data platform with apache iceberg
Building an open data platform with apache icebergAlluxio, Inc.
 
Streaming data for real time analysis
Streaming data for real time analysisStreaming data for real time analysis
Streaming data for real time analysisAmazon Web Services
 
Pinterest’s Story of Streaming Hundreds of Terabytes of Pins from MySQL to S3...
Pinterest’s Story of Streaming Hundreds of Terabytes of Pins from MySQL to S3...Pinterest’s Story of Streaming Hundreds of Terabytes of Pins from MySQL to S3...
Pinterest’s Story of Streaming Hundreds of Terabytes of Pins from MySQL to S3...confluent
 

What's hot (20)

Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Presto Summit 2018 - 09 - Netflix Iceberg
Presto Summit 2018  - 09 - Netflix IcebergPresto Summit 2018  - 09 - Netflix Iceberg
Presto Summit 2018 - 09 - Netflix Iceberg
 
How Adobe Does 2 Million Records Per Second Using Apache Spark!
How Adobe Does 2 Million Records Per Second Using Apache Spark!How Adobe Does 2 Million Records Per Second Using Apache Spark!
How Adobe Does 2 Million Records Per Second Using Apache Spark!
 
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
Unify Stream and Batch Processing using Dataflow, a Portable Programmable Mod...
 
CDC Stream Processing With Apache Flink With Timo Walther | Current 2022
CDC Stream Processing With Apache Flink With Timo Walther | Current 2022CDC Stream Processing With Apache Flink With Timo Walther | Current 2022
CDC Stream Processing With Apache Flink With Timo Walther | Current 2022
 
ksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database SystemksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database System
 
Autoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeAutoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive Mode
 
Apache Flink 101 - the rise of stream processing and beyond
Apache Flink 101 - the rise of stream processing and beyondApache Flink 101 - the rise of stream processing and beyond
Apache Flink 101 - the rise of stream processing and beyond
 
Making Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta LakeMaking Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta Lake
 
Elastic Stack Introduction
Elastic Stack IntroductionElastic Stack Introduction
Elastic Stack Introduction
 
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
Improving SparkSQL Performance by 30%: How We Optimize Parquet Pushdown and P...
 
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
 
A Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiA Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and Hudi
 
Improving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at UberImproving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at Uber
 
Evening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in FlinkEvening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in Flink
 
A Practical Enterprise Feature Store on Delta Lake
A Practical Enterprise Feature Store on Delta LakeA Practical Enterprise Feature Store on Delta Lake
A Practical Enterprise Feature Store on Delta Lake
 
Building an open data platform with apache iceberg
Building an open data platform with apache icebergBuilding an open data platform with apache iceberg
Building an open data platform with apache iceberg
 
Netflix Data Pipeline With Kafka
Netflix Data Pipeline With KafkaNetflix Data Pipeline With Kafka
Netflix Data Pipeline With Kafka
 
Streaming data for real time analysis
Streaming data for real time analysisStreaming data for real time analysis
Streaming data for real time analysis
 
Pinterest’s Story of Streaming Hundreds of Terabytes of Pins from MySQL to S3...
Pinterest’s Story of Streaming Hundreds of Terabytes of Pins from MySQL to S3...Pinterest’s Story of Streaming Hundreds of Terabytes of Pins from MySQL to S3...
Pinterest’s Story of Streaming Hundreds of Terabytes of Pins from MySQL to S3...
 

Similar to XStream: stream processing platform at facebook

Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...
Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...
Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...Flink Forward
 
Apache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's NextApache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's NextPrateek Maheshwari
 
Big Data Analytics Platforms by KTH and RISE SICS
Big Data Analytics Platforms by KTH and RISE SICSBig Data Analytics Platforms by KTH and RISE SICS
Big Data Analytics Platforms by KTH and RISE SICSBig Data Value Association
 
Scaling up Near Real-time Analytics @Uber &LinkedIn
Scaling up Near Real-time Analytics @Uber &LinkedInScaling up Near Real-time Analytics @Uber &LinkedIn
Scaling up Near Real-time Analytics @Uber &LinkedInC4Media
 
Delivering the power of data using Spring Cloud DataFlow and DataStax Enterpr...
Delivering the power of data using Spring Cloud DataFlow and DataStax Enterpr...Delivering the power of data using Spring Cloud DataFlow and DataStax Enterpr...
Delivering the power of data using Spring Cloud DataFlow and DataStax Enterpr...VMware Tanzu
 
Structured Streaming in Spark
Structured Streaming in SparkStructured Streaming in Spark
Structured Streaming in SparkDigital Vidya
 
The Never Landing Stream with HTAP and Streaming
The Never Landing Stream with HTAP and StreamingThe Never Landing Stream with HTAP and Streaming
The Never Landing Stream with HTAP and StreamingTimothy Spann
 
Event Driven Microservices
Event Driven MicroservicesEvent Driven Microservices
Event Driven MicroservicesFabrizio Fortino
 
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Guido Schmutz
 
Cloud lunch and learn real-time streaming in azure
Cloud lunch and learn real-time streaming in azureCloud lunch and learn real-time streaming in azure
Cloud lunch and learn real-time streaming in azureTimothy Spann
 
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedInGrokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedInGrokking VN
 
Spark and machine learning in microservices architecture
Spark and machine learning in microservices architectureSpark and machine learning in microservices architecture
Spark and machine learning in microservices architectureStepan Pushkarev
 
Otimizações de Projetos de Big Data, Dw e AI no Microsoft Azure
Otimizações de Projetos de Big Data, Dw e AI no Microsoft AzureOtimizações de Projetos de Big Data, Dw e AI no Microsoft Azure
Otimizações de Projetos de Big Data, Dw e AI no Microsoft AzureLuan Moreno Medeiros Maciel
 
Introduction to SQLStreamBuilder: Rich Streaming SQL Interface for Creating a...
Introduction to SQLStreamBuilder: Rich Streaming SQL Interface for Creating a...Introduction to SQLStreamBuilder: Rich Streaming SQL Interface for Creating a...
Introduction to SQLStreamBuilder: Rich Streaming SQL Interface for Creating a...Eventador
 
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...Lightbend
 
Unconference Round Table Notes
Unconference Round Table NotesUnconference Round Table Notes
Unconference Round Table NotesTimothy Spann
 
Scalable Stream Processing with Apache Samza
Scalable Stream Processing with Apache SamzaScalable Stream Processing with Apache Samza
Scalable Stream Processing with Apache SamzaPrateek Maheshwari
 
SQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesSQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesEduardo Castro
 

Similar to XStream: stream processing platform at facebook (20)

Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...
Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...
Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...
 
Apache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's NextApache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's Next
 
Big Data Analytics Platforms by KTH and RISE SICS
Big Data Analytics Platforms by KTH and RISE SICSBig Data Analytics Platforms by KTH and RISE SICS
Big Data Analytics Platforms by KTH and RISE SICS
 
Scaling up Near Real-time Analytics @Uber &LinkedIn
Scaling up Near Real-time Analytics @Uber &LinkedInScaling up Near Real-time Analytics @Uber &LinkedIn
Scaling up Near Real-time Analytics @Uber &LinkedIn
 
Delivering the power of data using Spring Cloud DataFlow and DataStax Enterpr...
Delivering the power of data using Spring Cloud DataFlow and DataStax Enterpr...Delivering the power of data using Spring Cloud DataFlow and DataStax Enterpr...
Delivering the power of data using Spring Cloud DataFlow and DataStax Enterpr...
 
Structured Streaming in Spark
Structured Streaming in SparkStructured Streaming in Spark
Structured Streaming in Spark
 
Chti jug - 2018-06-26
Chti jug - 2018-06-26Chti jug - 2018-06-26
Chti jug - 2018-06-26
 
Jug - ecosystem
Jug -  ecosystemJug -  ecosystem
Jug - ecosystem
 
The Never Landing Stream with HTAP and Streaming
The Never Landing Stream with HTAP and StreamingThe Never Landing Stream with HTAP and Streaming
The Never Landing Stream with HTAP and Streaming
 
Event Driven Microservices
Event Driven MicroservicesEvent Driven Microservices
Event Driven Microservices
 
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
 
Cloud lunch and learn real-time streaming in azure
Cloud lunch and learn real-time streaming in azureCloud lunch and learn real-time streaming in azure
Cloud lunch and learn real-time streaming in azure
 
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedInGrokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
 
Spark and machine learning in microservices architecture
Spark and machine learning in microservices architectureSpark and machine learning in microservices architecture
Spark and machine learning in microservices architecture
 
Otimizações de Projetos de Big Data, Dw e AI no Microsoft Azure
Otimizações de Projetos de Big Data, Dw e AI no Microsoft AzureOtimizações de Projetos de Big Data, Dw e AI no Microsoft Azure
Otimizações de Projetos de Big Data, Dw e AI no Microsoft Azure
 
Introduction to SQLStreamBuilder: Rich Streaming SQL Interface for Creating a...
Introduction to SQLStreamBuilder: Rich Streaming SQL Interface for Creating a...Introduction to SQLStreamBuilder: Rich Streaming SQL Interface for Creating a...
Introduction to SQLStreamBuilder: Rich Streaming SQL Interface for Creating a...
 
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
 
Unconference Round Table Notes
Unconference Round Table NotesUnconference Round Table Notes
Unconference Round Table Notes
 
Scalable Stream Processing with Apache Samza
Scalable Stream Processing with Apache SamzaScalable Stream Processing with Apache Samza
Scalable Stream Processing with Apache Samza
 
SQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesSQL Server 2008 Integration Services
SQL Server 2008 Integration Services
 

Recently uploaded

Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilVinayVitekari
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxNadaHaitham1
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxchumtiyababu
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 

Recently uploaded (20)

Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 

XStream: stream processing platform at facebook

  • 1. XStream - A Planetary Scale Stream Processing Platform at Facebook Shuyi Chen Software Engineer Committer of Apache Flink & Calcite Aniket Mokashi Engineering Manager PMC of Apache Pig & Parquet PHOTO
  • 2. Agenda ● Stream processing use cases ● Brief history of real-time data processing at Facebook ● Introduction to XStream ● XStream Design Principles ○ Stylus (C++) ○ CoreSQL - Single Dialect across Engines ○ Interpretive execution ○ Vectorized Execution Stream Processing at Facebook
  • 3. Streaming Data Flow at FB High Availability and Low Latency are important to our business Devices Web Others Event Producers Messaging Pipe = Scribe Stream Processing Pipelines Warehouse, for retention and complex queries Scribe, messaging bus Publish / Serve Scuba for quick analytics and troubleshooting Services A typical streaming data flow...
  • 4. Use Cases @ Facebook Diversity of Use Cases • Time series analytics – calculate metrics over time windows and stream to another Scribe category, dashboard or Scuba • Real time dashboards/Scuba – aggregate and process Scribe to feed dashboards or another Scribe category • Real time metrics – Custom metrics or triggers for real time monitoring, notifications or alarms Stream Analytics • Clean, enrich, organize, and transform raw Scribe prior to loading to warehouse reducing or eliminating batch ETL steps • Common built-in operators to transform, aggregate, and filter streaming data • Enable various stages of the ML life cycle E.g., feature engineering • Enable predictive analytics, fraud detection, real-time personalization, and other advanced analytics use cases Stream Transform Real-Time AI/ML
  • 5. Stream Processing Ecosystem Read more: Realtime Data Processing at Facebook LogDevice · Distributed storage for sequential data A look at the history Scribe Persistent, distributed messaging system Fully Managed Stream Processing service - Authored in a SQL like language with UDFs written in Java Puma Swift Simplistic Stream processing library - Authored in Python Stylus Low level stream processing framework in C++ Laser Key-value store on top of RocksDB for lookup joins Scuba Slice-and-dice analysis data store
  • 8. Stream Processing Ecosystem Goals Then.. ● Move Fast ● Ease of use, deployment and debugging ● Monitoring and operations Now.. ● Move fast with stable infrastructure ● Consistent use - low cognitive overhead ● Performance at Scale ● Consolidation ● Intelligent monitoring and low operational costs Evolution from then to now
  • 9. XStream One Unified “Fully Managed” Stream Processing Platform Enable customers to build applications that can react to events in real-time, produce analytics at source and minimize the data to insights and actioning cycle. Mission
  • 10. Why not open source? On-Prem and Cloud Services Comparison Auto Scaling Load Balance Privacy & Security Data Quality SQL Relational API Functional API Apache Flink No No No No Flink SQL Flink Table API DataStream Spark Streaming Yes Yes No Deequ (AWS) Spark SQL Spark Dataset RDD Apache Samza Yes (manual) Yes No No Samza SQL No Samza High-level API Apache Beam Yes Yes No No Beam SQL No PTransform API AWS Kinesis Analytics Yes Yes Yes No ANSI 2008 with extensions Yes Table API No Google Cloud DataFlow Yes Yes Yes No (Trifacta for upfront) SQL like non-compliant Yes No XStream Yes Yes Yes No CoreSQL SQL 2016 with extensions Fluent API Stylus functional
  • 11. XStream Overview • Accelerate Developer Velocity - Just write business logic and let us manage everything else - Important at FB Scale - Even more important so developers don’t just focus on KTLO - Authoring ease / Write once, run many with one SQL dialect shared across batch, interactive and streaming use cases • Efficiency and Performance - ~2x more efficient than predecessor and tighter integration with Native C++ engine • Fully Managed Service - No need to worry about scaling, backups, patching etc. - Managed platform means low ops load and scaling on demand to 10s of thousands of jobs Planetary Scale Fully Managed Event Processing System Why XStream?
  • 12. XStream Engine Overview • Stylus C++ framework • Design principles • Performance study Query Planner & Optimizer Language SQL & DataFrame Query Runtime Stylus
  • 13. XStream Engine Overview ● Stylus is a distributed fault-tolerant & scalable stream processing engine at FB ○ Sources/sinks ○ Operators ○ Watermark ○ Checkpoint ○ Trigger & timer ○ State backend ● However ○ It has steep learning curve ○ High maintenance and operational cost Stylus C++ framework
  • 14. XStream Engine Overview • We built XStream with C++ on top of the stylus stream processing framework • We use a common SQL dialect as Spark & Presto • We adopt interpretation over up-front compilation • We build & share the vectorized SQL evaluation engine with Presto & Spark Principles
  • 15. XStream Engine Overview • C++ based Stylus stream processing framework is mature & widely used in FB • Java support is very limited in FB • Many service backend & business logic are written in C++ • Efficiency & performance is an important factor Why C++ for XStream?
  • 16. CoreSQL A single dialect for all SQLs in FB • Offer a single SQL dialect and framework across different tools in FB • Modernize Presto SQL language with SQL 2016 standard • Makes moving between different engines easy based off use cases • Bring other extensions from Streaming, and Graph SQL into this modernized Presto SQL language. • Enable UDFs portability across engines • Open source XStream integrate CoreSQL by implementing the streaming extension support • Tumbling window with multi window support • Sliding window with multi slide & multi window support • Session window A common SQL dialects across FB
  • 17. Query Execution (C++) Up-front compilation • Planner codegen entire C++ pipeline and compiles into machine code - Highly optimized code • However, - One binary per pipeline - Hard to scale operationally - Reliability concern - Long build time → low dev efficiency SELECT SUM(action), type FROM action_by_type GROUP BY type Main.cpp: from(“action_by_type”) -> map(...) -> keyBy(“type”) ->aggregate(“sum(action)”) ->toSink(...) XStream/Stylus C++ libraries Binary Compile & build Deploy
  • 18. Query Execution Interpretation • Planner generate distributed execution plan and each C++ worker node interpret the local plan and execute interpretively. - No build process needed - Single engine binary for all pipelines - Easier to scale operationally • However, to achieve high efficiency/performance, interpretation usually use vector-at-a-time processing on columnar data representation - Amortize interpretation overhead - Hide cache miss latency - Leverage SIMD support SELECT SUM(action), type FROM action_by_type GROUP BY type Execution Plan as JSON: XStreamSource(“action_by_type”) → XStreamCalc() → XStreamWindowAggregate(“sum( action)”) → XStreamSink(...) Deploy Turbine Engine Binary Weekly release manage d by XStrea m
  • 19. Velox Overview New C++ vectorized SQL evaluation engine Provide universal and state-of-art building blocks for compute Why? • Efficiency and Latency • Consistency • Reusability and Engineering Efficiency Goal is to unify eval engines across FB & beyond • Presto • Spark • XStream • Etc. Already Open source! Task, driver Operators Expression evaluation Vectors
  • 20. XStream Engine Stack Query Planner Logical plan Physical plan XStream local planner XStream Query Runtime Velox Expression evaluation Velox Vectors XStream Columnar Source/Sinks/Operators Stylus framework CoreSQL Dataframe XStream local planner XStream Query Runtime Stylus framework
  • 21. Performance • Velox (cpp vs java) - 2-10x CPU improvements in initial subset of Presto interactive workload evaluated • XStream stateless workload (interpretive vs compiled) - With ~100 events of micro-batching, interpretation performs ~ as compilation with 10%-30% memory saving during normal processing - During catching up lag, interpretation beat compilation by 30-50% in throughput with same CPU and slightly less memory usage
  • 22. Planetary Scale Stream Processing - The Future We’re just getting started - Two flavors, one for platform and the other for long-tail! • Fully Managed Service - Both PaaS and SaaS - Full SQL support - Advanced Streaming Systems features eg - backfill support - Cost based optimizer • Build a portable UDF ecosystem. Common UDFs that run across FB’s Data Infrastructure • Come join us!