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

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
 
Apache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic DatasetsApache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic DatasetsAlluxio, Inc.
 
Observability for Data Pipelines With OpenLineage
Observability for Data Pipelines With OpenLineageObservability for Data Pipelines With OpenLineage
Observability for Data Pipelines With OpenLineageDatabricks
 
The Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesThe Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesDatabricks
 
Understanding Query Plans and Spark UIs
Understanding Query Plans and Spark UIsUnderstanding Query Plans and Spark UIs
Understanding Query Plans and Spark UIsDatabricks
 
Running Apache NiFi with Apache Spark : Integration Options
Running Apache NiFi with Apache Spark : Integration OptionsRunning Apache NiFi with Apache Spark : Integration Options
Running Apache NiFi with Apache Spark : Integration OptionsTimothy Spann
 
Streaming sql and druid
Streaming sql and druid Streaming sql and druid
Streaming sql and druid arupmalakar
 
Building a Data Pipeline using Apache Airflow (on AWS / GCP)
Building a Data Pipeline using Apache Airflow (on AWS / GCP)Building a Data Pipeline using Apache Airflow (on AWS / GCP)
Building a Data Pipeline using Apache Airflow (on AWS / GCP)Yohei Onishi
 
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational CacheUsing Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational CacheDremio Corporation
 
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021StreamNative
 
Introducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorIntroducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorFlink Forward
 
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
 
Apache Flink: Real-World Use Cases for Streaming Analytics
Apache Flink: Real-World Use Cases for Streaming AnalyticsApache Flink: Real-World Use Cases for Streaming Analytics
Apache Flink: Real-World Use Cases for Streaming AnalyticsSlim Baltagi
 
Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internalsKostas Tzoumas
 
Delta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin AmbardDelta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin AmbardParis Data Engineers !
 
Tuning Apache Kafka Connectors for Flink.pptx
Tuning Apache Kafka Connectors for Flink.pptxTuning Apache Kafka Connectors for Flink.pptx
Tuning Apache Kafka Connectors for Flink.pptxFlink Forward
 
Building Robust ETL Pipelines with Apache Spark
Building Robust ETL Pipelines with Apache SparkBuilding Robust ETL Pipelines with Apache Spark
Building Robust ETL Pipelines with Apache SparkDatabricks
 

What's hot (20)

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
 
Apache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic DatasetsApache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic Datasets
 
Observability for Data Pipelines With OpenLineage
Observability for Data Pipelines With OpenLineageObservability for Data Pipelines With OpenLineage
Observability for Data Pipelines With OpenLineage
 
The Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesThe Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization Opportunities
 
Spark SQL
Spark SQLSpark SQL
Spark SQL
 
Understanding Query Plans and Spark UIs
Understanding Query Plans and Spark UIsUnderstanding Query Plans and Spark UIs
Understanding Query Plans and Spark UIs
 
Running Apache NiFi with Apache Spark : Integration Options
Running Apache NiFi with Apache Spark : Integration OptionsRunning Apache NiFi with Apache Spark : Integration Options
Running Apache NiFi with Apache Spark : Integration Options
 
Streaming sql and druid
Streaming sql and druid Streaming sql and druid
Streaming sql and druid
 
Building a Data Pipeline using Apache Airflow (on AWS / GCP)
Building a Data Pipeline using Apache Airflow (on AWS / GCP)Building a Data Pipeline using Apache Airflow (on AWS / GCP)
Building a Data Pipeline using Apache Airflow (on AWS / GCP)
 
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational CacheUsing Apache Arrow, Calcite, and Parquet to Build a Relational Cache
Using Apache Arrow, Calcite, and Parquet to Build a Relational Cache
 
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
 
Introducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorIntroducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes Operator
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
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
 
Twitter Stream Processing
Twitter Stream ProcessingTwitter Stream Processing
Twitter Stream Processing
 
Apache Flink: Real-World Use Cases for Streaming Analytics
Apache Flink: Real-World Use Cases for Streaming AnalyticsApache Flink: Real-World Use Cases for Streaming Analytics
Apache Flink: Real-World Use Cases for Streaming Analytics
 
Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internals
 
Delta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin AmbardDelta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
 
Tuning Apache Kafka Connectors for Flink.pptx
Tuning Apache Kafka Connectors for Flink.pptxTuning Apache Kafka Connectors for Flink.pptx
Tuning Apache Kafka Connectors for Flink.pptx
 
Building Robust ETL Pipelines with Apache Spark
Building Robust ETL Pipelines with Apache SparkBuilding Robust ETL Pipelines with Apache Spark
Building Robust ETL Pipelines with Apache Spark
 

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

UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSrknatarajan
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 

Recently uploaded (20)

UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 

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!