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

What's hot (20)

Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...
Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...
Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...
 
Changelog Stream Processing with Apache Flink
Changelog Stream Processing with Apache FlinkChangelog Stream Processing with Apache Flink
Changelog Stream Processing with Apache Flink
 
Dataflow with Apache NiFi
Dataflow with Apache NiFiDataflow with Apache NiFi
Dataflow with Apache NiFi
 
Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...
Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...
Interactive real-time dashboards on data streams using Kafka, Druid, and Supe...
 
Running Apache Spark on Kubernetes: Best Practices and Pitfalls
Running Apache Spark on Kubernetes: Best Practices and PitfallsRunning Apache Spark on Kubernetes: Best Practices and Pitfalls
Running Apache Spark on Kubernetes: Best Practices and Pitfalls
 
ksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database SystemksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database System
 
How Uber scaled its Real Time Infrastructure to Trillion events per day
How Uber scaled its Real Time Infrastructure to Trillion events per dayHow Uber scaled its Real Time Infrastructure to Trillion events per day
How Uber scaled its Real Time Infrastructure to Trillion events per day
 
Apache Flink Training: System Overview
Apache Flink Training: System OverviewApache Flink Training: System Overview
Apache Flink Training: System Overview
 
How We Optimize Spark SQL Jobs With parallel and sync IO
How We Optimize Spark SQL Jobs With parallel and sync IOHow We Optimize Spark SQL Jobs With parallel and sync IO
How We Optimize Spark SQL Jobs With parallel and sync IO
 
Real-time Twitter Sentiment Analysis and Image Recognition with Apache NiFi
Real-time Twitter Sentiment Analysis and Image Recognition with Apache NiFiReal-time Twitter Sentiment Analysis and Image Recognition with Apache NiFi
Real-time Twitter Sentiment Analysis and Image Recognition with Apache NiFi
 
NiFi Best Practices for the Enterprise
NiFi Best Practices for the EnterpriseNiFi Best Practices for the Enterprise
NiFi Best Practices for the Enterprise
 
Hive Bucketing in Apache Spark with Tejas Patil
Hive Bucketing in Apache Spark with Tejas PatilHive Bucketing in Apache Spark with Tejas Patil
Hive Bucketing in Apache Spark with Tejas Patil
 
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
 
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
 
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
 
Spark Shuffle Deep Dive (Explained In Depth) - How Shuffle Works in Spark
Spark Shuffle Deep Dive (Explained In Depth) - How Shuffle Works in SparkSpark Shuffle Deep Dive (Explained In Depth) - How Shuffle Works in Spark
Spark Shuffle Deep Dive (Explained In Depth) - How Shuffle Works in Spark
 
Flink vs. Spark
Flink vs. SparkFlink vs. Spark
Flink vs. Spark
 
How to build a streaming Lakehouse with Flink, Kafka, and Hudi
How to build a streaming Lakehouse with Flink, Kafka, and HudiHow to build a streaming Lakehouse with Flink, Kafka, and Hudi
How to build a streaming Lakehouse with Flink, Kafka, and Hudi
 
Presto on Apache Spark: A Tale of Two Computation Engines
Presto on Apache Spark: A Tale of Two Computation EnginesPresto on Apache Spark: A Tale of Two Computation Engines
Presto on Apache Spark: A Tale of Two Computation Engines
 

Similar to XStream: stream processing platform at facebook

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
 
Unconference Round Table Notes
Unconference Round Table NotesUnconference Round Table Notes
Unconference Round Table Notes
Timothy Spann
 

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

Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
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...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 

Recently uploaded (20)

Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
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
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
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
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
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...
 
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...
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
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...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
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
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
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
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 

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!