Model Serving via Pulsar Functions

Arun Kejariwal
Arun KejariwalStatistical Learning Principal at Machine Zone, Inc.
1
A r u n K e j a r i w a l
K a r t h i k R a m a s a m y
MODEL SERVING VIA
PULSAR FUNCTIONS
2
AI FOR THE
ENTERPRISE
Annual revenue: $3.7 B (2017) → $80.7 (2025) [1]
Content Acquisition
✦ Disparate sources
Content Understanding
✦ Unstructured text
๏ Learning the context is key and non-trivial
✦ Dynamic
๏ Continuous learning and maintenance
[1] https://www.tractica.com/research/artificial-intelligence-for-enterprise-applications/
3
ML/AI FOR THE ENTERPRISE
ML MODELS
NEURAL NETWORKS
REINFORCEMENT LEARNING
T R A I N I N G
FEATURES
EMBEDDINGS
S T O R A G E
ONLINE
REAL-TIME
S E R V I N G
4
SERVING
L O W L AT E N C Y H I G H
T H R O U G H P U T
G R A C E F U L
D E G R A D AT I O N
T H R E E P I L L A R S
5
SERVING
A P P L I C AT I O N
C O D E C H A N G E
D E B U G G I N G
D E P L O Y M E N T L O N G E R T I M E
TO I T E R AT E
C Y C L E S
C H A L L E N G E S
6
LEVERAGING SERVERLESS
✦ REAL-TIME
✦ HIGHLY SCALABLE
✦ FAULT TOLERANT
✦ EASILY PROGRAMMABLE
✦ SUPPORT FOR PLUG-AND-PLAY ANALYTICS
7
SERVERLESS
E V O L U T I O N *
* Figure borrowed from "Serverless Is More: From PaaS to Present Cloud Computing", by Eyk et al. 2018.
8
SERVERLESS
A N O V E R V I E W
F u n c t i o n a s a S e r v i c e ( F a a S ) B a c k e n d a s a S e r v i c e ( B a a S )
AW S L a m b d a , G o o g l e C l o u d F u n c t i o n s
I B M C l o u d F u n c t i o n s
O b j e c t s t o ra g e ,
D a t a b a s e s ,
M e s s a g i n g
9
SERVERLESS
C L O U D F U N C T I O N S
* Figure borrowed from "Serverless Computation with OpenLambda", by Hendrickson et al. 2018.
10
Execution without managing
resource allocation
From x86 machine code to
high-level programming
languages
CODE
Is stateless
Event driven
Fine-grain autoscaling
Decoupled from storage
COMPUTATION
Resources used instead of
resources allocated
100 ms increment
BILLING
SERVERLESS
A N O V E R V I E W
11
APACHE PULSAR
R E A L - T I M E M E S S A G I N G + S T O R A G E
M O D E L U P D AT E W I T H O U T R E S TA R T I N G T H E A P P L I C AT I O N
N AT I V E S U P P O R T F O R S E R V E R L E S S S T R E A M F U N C T I O N S
A N O V E R V I E W
12
APACHE PULSAR
T E R M I N O L O G Y
Apache Pulsar Cluster
Product
Safety
ETL
Fraud
Detection
Topic-1
Account History
Topic-2
User Clustering
Topic-1
Risk Classification
MarketingCampaigns
ETL
Topic-1
Budgeted Spend
Topic-2
Demographic Classification
Topic-1
Location Resolution
Data
Serving
Microservice
Topic-1
Customer Authentication
Tenants
Namespaces
Topics
13
APACHE PULSAR
DURABILITY MULTI-TENANCY TIERED STORAGE UNIFIED MESSAGING
& QUEUING
HIGHLY SCALABLE
K E Y C H A R AC T E R I S T I C S
14
APACHE PULSAR
I N D E P E N D E N T S C A L A B I L I T Y
I N S TA N T S C A L A B I L I T Y
F A U L T TO L E R A N C E
A R C H I T E C T U R A L D E S I G N
Bookie Bookie Bookie
Broker Broker Broker
Producer Consumer
15
APACHE PULSAR
W R I T E
TA I L I N G R E A D S
C ATC H U P R E A D S
AC C E S S PAT T E R N S
16
PULSAR FUNCTIONS
S I M P L E S T P O S S I B L E A P I F U N C T I O N O R A P R O C E D U R E
S U P P O R T F O R M U L T I - L A N G U A G E ( J a v a & P y t h o n )
F L E X I B L E R U N T I M E
I N T R O D U C T I O N
17
PULSAR FUNCTIONS
I N T R O D U C T I O N
Pulsar Function
i/p topic 1
i/p topic 2
i/p topic 3
o/p topic 1
o/p topic 2
o/p topic 3
18
PULSAR FUNCTIONS
I N T R O D U C T I O N
import java.util.function.Function;
public class ExclamationFunction implements Function<String, String> {
@Override
public String apply(String input) {
return input + "!";
}
}
Exclamation Functioni/p topic 1 o/p topic 2
strings strings
19
PULSAR FUNCTIONS
AT L E A S T O N C E
AT M O S T O N C E
E X A C T L Y O N C E
P R O C E S S I N G G UA R A N T E E S
20
PULSAR FUNCTIONS
D Y N A M I C D ATA R O U T I N G
D ATA F I L T E R I N G
D ATA E N R I C H M E N T
E V E N T P R O C E S S I N G D E S I G N PAT T E R N S
A L E R T S A N D T H R E S H O L D S
D ATA T R A N S F O R M AT I O N S
C O U N T I N G W I T H W I N D O W S
21
T H R E A D S P R O C E S S E S C O N T A I N E R S
PULSAR FUNCTIONS
D E P L O Y M E N T
22
PULSAR FUNCTIONS
D E P L O Y M E N T
Broker 1
Worker
Function
wordcount-1
Function
transform-2
Broker 1
Worker
Function
transform-1
Function
dataroute-1
Broker 1
Worker
Function
wordcount-2
Function
transform-3
Node 1 Node 2 Node 3
23
PULSAR FUNCTIONS
D E P L O Y M E N T
Worker
Function
wordcount-1
Function
transform-2
Worker
Function
transform-1
Function
dataroute-1
Worker
Function
wordcount-2
Function
transform-3
Node 1 Node 2 Node 3
Broker 1 Broker 2 Broker 3
Node 4 Node 5 Node 6
24
PULSAR FUNCTIONS
D E P L O Y M E N T - K U B E R N E T E S
Function
wordcount-1
Function
transform-1
Function
transform-3
Pod 1 Pod 2 Pod 3
Broker 1 Broker 2 Broker 3
Pod 7 Pod 8 Pod 9
Function
dataroute-1
Function
wordcount-2
Function
transform-2
Pod 4 Pod 5 Pod 6
25
PULSAR FUNCTIONS
D ATA T R A N S F O R M AT I O N
D ATA E X T R A C T I O N
C O N T E N T R O U T I N G & F I L T E R I N G
U S E C A S E S I N DATA E N G I N E E R I N G
26
APACHE PULSAR
+
MODEL SERVING
* Figure borrowed from "A Case for Serverless Machine Learning", by Carreira et al. 2018.
*
D I S T R I B U T E D M L
Hundreds of concurrent workers
Map to serverless functions
Backend manages compute
resources and task scheduling
ML PIPELINE
T R A I N I N G
27
ML PIPELINE
I N F E R E N C E
G U I D I N G D E C I S I O N M A K I N G
Calls for less computational power than training
RESTful endpoint for Functions
✦ Available via HTTP GET request
Model size
✦ Tens of MB to over a GB
Cold start → Warm start
✦ Function reuse
Backend manages compute resources and task scheduling
28
29
Model Serving
Pulsar Function
Model Stream
Data Stream
model i/p topic
data i/p topic
Inference Stream
Inference o/p topic
MODEL SERVING
30
Model Stream
Data Stream
model i/p topic
data i/p topic
Inference Stream
inference o/p topic
MODEL
MODEL SERVING
31
Model Stream
Data Stream
model i/p topic
data i/p topic
Inference Stream
inference o/p topicMODELold
MODELnew
MODEL SERVING
32
Model Stream
Data Stream
model i/p topic
data i/p topic
Inference Stream
inference o/p topic
MODEL
User Defined Metrics
Recall
Precision
MODEL SERVING
M E T R I C S
DATA
SKETCHES
Approximate
✦ Probabilistic Bounds
Accuracy-Speed Trade-off
One Pass
Incremental
Low memory footprint
A S M O D E L S
33
34
FLAVORS
O F DATA S K E TC H E S
S A M P L I N G C A R D I N A L I T YF I L T E R I N G
F R E Q U E N T
E L E M E N T S
A N O M A L Y
D E T E C T I O N
Q U A N T I L E S
35
FILTERING
B L O O M F I L T E R
MEMBERSHIP
import org.apache.pulsar.functions.api.Context;
import org.apache.pulsar.functions.api.Function;
import com.clearspring.analytics.stream.membership.BloomFilter;
public class BloomFilterFunction implements Function<String, Void> {
BloomFilter filter = new BloomFilter(20, 20);
Void process(String input, Context context) throws Exception {
if (!filter.isPresent(input)) {
filter.add(input);
// Route to “not seen” topic
context.publish(“notSeenTopic”, input);
}
return null;
}
}
36
FREQUENT ELEMENTS
C O U N T - M I N S K E T C H
FREQUENCY
import org.apache.pulsar.functions.api.Context;
import org.apache.pulsar.functions.api.Function;
import com.clearspring.analytics.stream.frequency.CountMinSketch;
public class CountMinFunction implements Function<String, Void> {
CountMinSketch sketch = new CountMinSketch(20, 20, 128);
Void process(String input, Context context) throws Exception {
sketch.add(input, 1); // Calculates bit indexes and performs +1
long count = sketch.estimateCount(input);
// React to the updated count
return null;
}
}
37
CARDINALITY
H Y P E R L O G L O G
# UNIQUE ELEMENTS
import org.apache.pulsar.functions.api.Context;
import org.apache.pulsar.functions.api.Function;
import io.airlift.stats.cardinality.HyperLogLog;
public class HyperLogLogFunction implements Function<Integer, Void> {
HyperLogLog hll = HyperLogLog.newInstance(2048);
Void process(Integer value, Context context) throws Exception {
hll.add(value);
Integer numDistinctElements = hll.cardinality();
// Do something with the distinct elements
}
}
38
SEVERLESS ML
G P U S U P P O R T
Key for Deep Learning
F A S T S H A R E D S T O R A G E
Functions do not talk to each other
Example: Crail*, Pocket
E X T E N D I N G T O T H E E D G E
Functions running on
✦ Smartphones
✦ IoT Devices
G O I N G F O R WA R D
* https://crail.apache.org/
39
“It is better to fail
in originality than
to succeed in
imitation.”
H e r m a n M e l v i l l e
40
P R O J E C T D E S C R I P T I O N
41
https://streaml.io/blog/eda-real-time-analytics-with-pulsar-functions
MORE ON PULSAR
https://streaml.io/blog/eda-event-processing-design-patterns-with-pulsar-functions
https://streaml.io/blog/apache-pulsar-architecture-designing-for-streaming-performance-and-scalability
https://www.businesswire.com/news/home/20180306005633/en/Apache-Pulsar-Outperforms-Apache-Kafka-2.5x-OpenMessaging
https://streaml.io/blog/intro-to-pulsar
https://pulsar.apache.org/
42
Efficient Construction of Approximate Ad-Hoc ML models Through Materialization and Reuse [Hasani et al. 2018]
READINGS
A Case for Serverless Machine Learning [Carreira et al. 2018]
Pocket: Elastic ephemeral storage for serverless analytics [Klimovic et al. 2018]
Serving deep learning models in a serverless platform [Ishakian et al. 2018]
PRETZEL: Opening the Black Box of Machine Learning Prediction Serving Systems [Lee et al. 2018]
Cloud Programming Simplified: A Berkeley View on Serverless Computing [Jona et al. 2019]
43
Serverless Is More: From PaaS to Present Cloud Computing [Eyk et al. 2018]
READINGS
Serverless Computing: Current Trends and Open Problems [Baldini et al. 2018]
Clipper: A low-latency online prediction serving system [Crankshaw et al. 2017]
Borg, Omega, and Kubernetes [Burns et al. 2016]
Serverless Computation with OpenLambda [Hendrickson et al. 2016]
TensorFlow Serving [https://www.tensorflow.org/tfx/guide/serving]
44
Architecture of a Serverless Machine Learning Model [https://cloud.google.com/solutions/architecture-of-a-serverless-ml-model]
READINGS
Pure serverless machine learning inference with AWS Lambda and Layers
[https://medium.com/merapar/pure-serverless-machine-learning-inference-with-aws-lambda-and-layers-979702d9ae49]
1 of 44

Recommended

Reliability Patterns for Fun and Profit by
Reliability Patterns for Fun and ProfitReliability Patterns for Fun and Profit
Reliability Patterns for Fun and ProfitLuis Mineiro
145 views32 slides
Meteor WWNRW Intro by
Meteor WWNRW IntroMeteor WWNRW Intro
Meteor WWNRW IntroStephan Hochhaus
1.5K views27 slides
Keynote - AWS Summit Milano 2018 by
Keynote - AWS Summit Milano 2018Keynote - AWS Summit Milano 2018
Keynote - AWS Summit Milano 2018Amazon Web Services
1.9K views126 slides
Meteor - not just for rockstars by
Meteor - not just for rockstarsMeteor - not just for rockstars
Meteor - not just for rockstarsStephan Hochhaus
3.3K views50 slides
SAI - Serverless Integration Architectures - 09/2019 by
SAI - Serverless Integration Architectures - 09/2019SAI - Serverless Integration Architectures - 09/2019
SAI - Serverless Integration Architectures - 09/2019Samuel Vandecasteele
36 views40 slides
Microservices With Spring Boot and Spring Cloud Netflix by
Microservices With Spring Boot and Spring Cloud NetflixMicroservices With Spring Boot and Spring Cloud Netflix
Microservices With Spring Boot and Spring Cloud NetflixKrzysztof Sobkowiak
489 views37 slides

More Related Content

Similar to Model Serving via Pulsar Functions

Profiling PyTorch for Efficiency & Sustainability by
Profiling PyTorch for Efficiency & SustainabilityProfiling PyTorch for Efficiency & Sustainability
Profiling PyTorch for Efficiency & Sustainabilitygeetachauhan
425 views37 slides
The Angular road from 1.x to 2.0 by
The Angular road from 1.x to 2.0The Angular road from 1.x to 2.0
The Angular road from 1.x to 2.0Vassilis Pitsounis
3.5K views36 slides
Introduction to Compiler Development by
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler DevelopmentLogan Chien
384 views99 slides
Puppet Camp Sydney 2014 - Evolving Design Patterns in AWS by
Puppet Camp Sydney 2014 - Evolving Design Patterns in AWSPuppet Camp Sydney 2014 - Evolving Design Patterns in AWS
Puppet Camp Sydney 2014 - Evolving Design Patterns in AWSjohnpainter_id_au
559 views62 slides
Sparklyr: Big Data enabler for R users by
Sparklyr: Big Data enabler for R usersSparklyr: Big Data enabler for R users
Sparklyr: Big Data enabler for R usersICTeam S.p.A.
1.4K views24 slides
Sparklyr: Big Data enabler for R users - Serena Signorelli, ICTEAM by
Sparklyr: Big Data enabler for R users - Serena Signorelli, ICTEAMSparklyr: Big Data enabler for R users - Serena Signorelli, ICTEAM
Sparklyr: Big Data enabler for R users - Serena Signorelli, ICTEAMData Science Milan
441 views24 slides

Similar to Model Serving via Pulsar Functions(20)

Profiling PyTorch for Efficiency & Sustainability by geetachauhan
Profiling PyTorch for Efficiency & SustainabilityProfiling PyTorch for Efficiency & Sustainability
Profiling PyTorch for Efficiency & Sustainability
geetachauhan425 views
Introduction to Compiler Development by Logan Chien
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
Logan Chien384 views
Puppet Camp Sydney 2014 - Evolving Design Patterns in AWS by johnpainter_id_au
Puppet Camp Sydney 2014 - Evolving Design Patterns in AWSPuppet Camp Sydney 2014 - Evolving Design Patterns in AWS
Puppet Camp Sydney 2014 - Evolving Design Patterns in AWS
johnpainter_id_au559 views
Sparklyr: Big Data enabler for R users by ICTeam S.p.A.
Sparklyr: Big Data enabler for R usersSparklyr: Big Data enabler for R users
Sparklyr: Big Data enabler for R users
ICTeam S.p.A.1.4K views
Sparklyr: Big Data enabler for R users - Serena Signorelli, ICTEAM by Data Science Milan
Sparklyr: Big Data enabler for R users - Serena Signorelli, ICTEAMSparklyr: Big Data enabler for R users - Serena Signorelli, ICTEAM
Sparklyr: Big Data enabler for R users - Serena Signorelli, ICTEAM
Data Science Milan441 views
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHP by Adam Englander
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHPphp[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
php[world] 2016 - You Don’t Need Node.js - Async Programming in PHP
Adam Englander496 views
機械学習エンジニアを見せたAWSの再:発明とは? 〜re:Invent 2018 参加レポート〜 by cyberagent
機械学習エンジニアを見せたAWSの再:発明とは? 〜re:Invent 2018 参加レポート〜機械学習エンジニアを見せたAWSの再:発明とは? 〜re:Invent 2018 参加レポート〜
機械学習エンジニアを見せたAWSの再:発明とは? 〜re:Invent 2018 参加レポート〜
cyberagent3.6K views
Soumith Chintala - Increasing the Impact of AI Through Better Software by MLconf
Soumith Chintala - Increasing the Impact of AI Through Better SoftwareSoumith Chintala - Increasing the Impact of AI Through Better Software
Soumith Chintala - Increasing the Impact of AI Through Better Software
MLconf646 views
Zend con 2016 - Asynchronous Prorgamming in PHP by Adam Englander
Zend con 2016 - Asynchronous Prorgamming in PHPZend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHP
Adam Englander520 views
Apache Spark: the next big thing? - StampedeCon 2014 by StampedeCon
Apache Spark: the next big thing? - StampedeCon 2014Apache Spark: the next big thing? - StampedeCon 2014
Apache Spark: the next big thing? - StampedeCon 2014
StampedeCon1.3K views
Winvision smart buildings presentation iot techfest brussel en by Remco Ploeg
Winvision smart buildings presentation iot techfest brussel enWinvision smart buildings presentation iot techfest brussel en
Winvision smart buildings presentation iot techfest brussel en
Remco Ploeg763 views
Open Source at AWS: Code, Contributions, Collaboration, and Communication by Amazon Web Services
Open Source at AWS: Code, Contributions, Collaboration, and CommunicationOpen Source at AWS: Code, Contributions, Collaboration, and Communication
Open Source at AWS: Code, Contributions, Collaboration, and Communication
Amazon Web Services1.7K views
MongoDB Europe 2016 - Using MongoDB to Build a Fast and Scalable Content Repo... by MongoDB
MongoDB Europe 2016 - Using MongoDB to Build a Fast and Scalable Content Repo...MongoDB Europe 2016 - Using MongoDB to Build a Fast and Scalable Content Repo...
MongoDB Europe 2016 - Using MongoDB to Build a Fast and Scalable Content Repo...
MongoDB953 views
Scaling Up AI Research to Production with PyTorch and MLFlow by Databricks
Scaling Up AI Research to Production with PyTorch and MLFlowScaling Up AI Research to Production with PyTorch and MLFlow
Scaling Up AI Research to Production with PyTorch and MLFlow
Databricks626 views
PyLadies Talk: Learn to love the command line! by Blanca Mancilla
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
Blanca Mancilla424 views
Innovations and trends in Cloud. Connectfest Porto 2019 by javier ramirez
Innovations and trends in Cloud. Connectfest Porto 2019Innovations and trends in Cloud. Connectfest Porto 2019
Innovations and trends in Cloud. Connectfest Porto 2019
javier ramirez152 views
The Changing Face of Government IT by Dustin Haisler
The Changing Face of Government ITThe Changing Face of Government IT
The Changing Face of Government IT
Dustin Haisler174 views
Microservices Delivery Platform. Tips & Tricks by Andrey Trubitsyn
Microservices Delivery Platform. Tips & TricksMicroservices Delivery Platform. Tips & Tricks
Microservices Delivery Platform. Tips & Tricks
Andrey Trubitsyn372 views
Scaling AI in production using PyTorch by geetachauhan
Scaling AI in production using PyTorchScaling AI in production using PyTorch
Scaling AI in production using PyTorch
geetachauhan191 views

More from Arun Kejariwal

Anomaly Detection At The Edge by
Anomaly Detection At The EdgeAnomaly Detection At The Edge
Anomaly Detection At The EdgeArun Kejariwal
581 views54 slides
Serverless Streaming Architectures and Algorithms for the Enterprise by
Serverless Streaming Architectures and Algorithms for the EnterpriseServerless Streaming Architectures and Algorithms for the Enterprise
Serverless Streaming Architectures and Algorithms for the EnterpriseArun Kejariwal
2.8K views227 slides
Sequence-to-Sequence Modeling for Time Series by
Sequence-to-Sequence Modeling for Time SeriesSequence-to-Sequence Modeling for Time Series
Sequence-to-Sequence Modeling for Time SeriesArun Kejariwal
3.2K views64 slides
Sequence-to-Sequence Modeling for Time Series by
Sequence-to-Sequence Modeling for Time SeriesSequence-to-Sequence Modeling for Time Series
Sequence-to-Sequence Modeling for Time SeriesArun Kejariwal
1.9K views45 slides
Designing Modern Streaming Data Applications by
Designing Modern Streaming Data ApplicationsDesigning Modern Streaming Data Applications
Designing Modern Streaming Data ApplicationsArun Kejariwal
2.6K views227 slides
Correlation Analysis on Live Data Streams by
Correlation Analysis on Live Data StreamsCorrelation Analysis on Live Data Streams
Correlation Analysis on Live Data StreamsArun Kejariwal
321 views64 slides

More from Arun Kejariwal(20)

Anomaly Detection At The Edge by Arun Kejariwal
Anomaly Detection At The EdgeAnomaly Detection At The Edge
Anomaly Detection At The Edge
Arun Kejariwal581 views
Serverless Streaming Architectures and Algorithms for the Enterprise by Arun Kejariwal
Serverless Streaming Architectures and Algorithms for the EnterpriseServerless Streaming Architectures and Algorithms for the Enterprise
Serverless Streaming Architectures and Algorithms for the Enterprise
Arun Kejariwal2.8K views
Sequence-to-Sequence Modeling for Time Series by Arun Kejariwal
Sequence-to-Sequence Modeling for Time SeriesSequence-to-Sequence Modeling for Time Series
Sequence-to-Sequence Modeling for Time Series
Arun Kejariwal3.2K views
Sequence-to-Sequence Modeling for Time Series by Arun Kejariwal
Sequence-to-Sequence Modeling for Time SeriesSequence-to-Sequence Modeling for Time Series
Sequence-to-Sequence Modeling for Time Series
Arun Kejariwal1.9K views
Designing Modern Streaming Data Applications by Arun Kejariwal
Designing Modern Streaming Data ApplicationsDesigning Modern Streaming Data Applications
Designing Modern Streaming Data Applications
Arun Kejariwal2.6K views
Correlation Analysis on Live Data Streams by Arun Kejariwal
Correlation Analysis on Live Data StreamsCorrelation Analysis on Live Data Streams
Correlation Analysis on Live Data Streams
Arun Kejariwal321 views
Deep Learning for Time Series Data by Arun Kejariwal
Deep Learning for Time Series DataDeep Learning for Time Series Data
Deep Learning for Time Series Data
Arun Kejariwal1.7K views
Correlation Analysis on Live Data Streams by Arun Kejariwal
Correlation Analysis on Live Data StreamsCorrelation Analysis on Live Data Streams
Correlation Analysis on Live Data Streams
Arun Kejariwal2.1K views
Modern real-time streaming architectures by Arun Kejariwal
Modern real-time streaming architecturesModern real-time streaming architectures
Modern real-time streaming architectures
Arun Kejariwal7.2K views
Anomaly detection in real-time data streams using Heron by Arun Kejariwal
Anomaly detection in real-time data streams using HeronAnomaly detection in real-time data streams using Heron
Anomaly detection in real-time data streams using Heron
Arun Kejariwal4.7K views
Data Data Everywhere: Not An Insight to Take Action Upon by Arun Kejariwal
Data Data Everywhere: Not An Insight to Take Action UponData Data Everywhere: Not An Insight to Take Action Upon
Data Data Everywhere: Not An Insight to Take Action Upon
Arun Kejariwal1.5K views
Real Time Analytics: Algorithms and Systems by Arun Kejariwal
Real Time Analytics: Algorithms and SystemsReal Time Analytics: Algorithms and Systems
Real Time Analytics: Algorithms and Systems
Arun Kejariwal23K views
Finding bad apples early: Minimizing performance impact by Arun Kejariwal
Finding bad apples early: Minimizing performance impactFinding bad apples early: Minimizing performance impact
Finding bad apples early: Minimizing performance impact
Arun Kejariwal1.1K views
Statistical Learning Based Anomaly Detection @ Twitter by Arun Kejariwal
Statistical Learning Based Anomaly Detection @ TwitterStatistical Learning Based Anomaly Detection @ Twitter
Statistical Learning Based Anomaly Detection @ Twitter
Arun Kejariwal5.1K views
Days In Green (DIG): Forecasting the life of a healthy service by Arun Kejariwal
Days In Green (DIG): Forecasting the life of a healthy serviceDays In Green (DIG): Forecasting the life of a healthy service
Days In Green (DIG): Forecasting the life of a healthy service
Arun Kejariwal793 views
Gimme More! Supporting User Growth in a Performant and Efficient Fashion by Arun Kejariwal
Gimme More! Supporting User Growth in a Performant and Efficient FashionGimme More! Supporting User Growth in a Performant and Efficient Fashion
Gimme More! Supporting User Growth in a Performant and Efficient Fashion
Arun Kejariwal2.3K views
A Systematic Approach to Capacity Planning in the Real World by Arun Kejariwal
A Systematic Approach to Capacity Planning in the Real WorldA Systematic Approach to Capacity Planning in the Real World
A Systematic Approach to Capacity Planning in the Real World
Arun Kejariwal5.5K views
Isolating Events from the Fail Whale by Arun Kejariwal
Isolating Events from the Fail WhaleIsolating Events from the Fail Whale
Isolating Events from the Fail Whale
Arun Kejariwal2K views

Recently uploaded

The Power of Generative AI in Accelerating No Code Adoption.pdf by
The Power of Generative AI in Accelerating No Code Adoption.pdfThe Power of Generative AI in Accelerating No Code Adoption.pdf
The Power of Generative AI in Accelerating No Code Adoption.pdfSaeed Al Dhaheri
39 views18 slides
The Power of Heat Decarbonisation Plans in the Built Environment by
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built EnvironmentIES VE
84 views20 slides
"Package management in monorepos", Zoltan Kochan by
"Package management in monorepos", Zoltan Kochan"Package management in monorepos", Zoltan Kochan
"Package management in monorepos", Zoltan KochanFwdays
34 views18 slides
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...The Digital Insurer
91 views52 slides
Cencora Executive Symposium by
Cencora Executive SymposiumCencora Executive Symposium
Cencora Executive Symposiummarketingcommunicati21
160 views14 slides
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsShapeBlue
247 views13 slides

Recently uploaded(20)

The Power of Generative AI in Accelerating No Code Adoption.pdf by Saeed Al Dhaheri
The Power of Generative AI in Accelerating No Code Adoption.pdfThe Power of Generative AI in Accelerating No Code Adoption.pdf
The Power of Generative AI in Accelerating No Code Adoption.pdf
Saeed Al Dhaheri39 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE84 views
"Package management in monorepos", Zoltan Kochan by Fwdays
"Package management in monorepos", Zoltan Kochan"Package management in monorepos", Zoltan Kochan
"Package management in monorepos", Zoltan Kochan
Fwdays34 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue247 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue120 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue207 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue152 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash162 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue183 views
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue196 views
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... by ShapeBlue
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
ShapeBlue178 views
"Node.js Development in 2024: trends and tools", Nikita Galkin by Fwdays
"Node.js Development in 2024: trends and tools", Nikita Galkin "Node.js Development in 2024: trends and tools", Nikita Galkin
"Node.js Development in 2024: trends and tools", Nikita Galkin
Fwdays33 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li91 views
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De... by Moses Kemibaro
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Moses Kemibaro35 views
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue225 views
Business Analyst Series 2023 - Week 4 Session 8 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8
DianaGray10145 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue265 views

Model Serving via Pulsar Functions

  • 1. 1 A r u n K e j a r i w a l K a r t h i k R a m a s a m y MODEL SERVING VIA PULSAR FUNCTIONS
  • 2. 2 AI FOR THE ENTERPRISE Annual revenue: $3.7 B (2017) → $80.7 (2025) [1] Content Acquisition ✦ Disparate sources Content Understanding ✦ Unstructured text ๏ Learning the context is key and non-trivial ✦ Dynamic ๏ Continuous learning and maintenance [1] https://www.tractica.com/research/artificial-intelligence-for-enterprise-applications/
  • 3. 3 ML/AI FOR THE ENTERPRISE ML MODELS NEURAL NETWORKS REINFORCEMENT LEARNING T R A I N I N G FEATURES EMBEDDINGS S T O R A G E ONLINE REAL-TIME S E R V I N G
  • 4. 4 SERVING L O W L AT E N C Y H I G H T H R O U G H P U T G R A C E F U L D E G R A D AT I O N T H R E E P I L L A R S
  • 5. 5 SERVING A P P L I C AT I O N C O D E C H A N G E D E B U G G I N G D E P L O Y M E N T L O N G E R T I M E TO I T E R AT E C Y C L E S C H A L L E N G E S
  • 6. 6 LEVERAGING SERVERLESS ✦ REAL-TIME ✦ HIGHLY SCALABLE ✦ FAULT TOLERANT ✦ EASILY PROGRAMMABLE ✦ SUPPORT FOR PLUG-AND-PLAY ANALYTICS
  • 7. 7 SERVERLESS E V O L U T I O N * * Figure borrowed from "Serverless Is More: From PaaS to Present Cloud Computing", by Eyk et al. 2018.
  • 8. 8 SERVERLESS A N O V E R V I E W F u n c t i o n a s a S e r v i c e ( F a a S ) B a c k e n d a s a S e r v i c e ( B a a S ) AW S L a m b d a , G o o g l e C l o u d F u n c t i o n s I B M C l o u d F u n c t i o n s O b j e c t s t o ra g e , D a t a b a s e s , M e s s a g i n g
  • 9. 9 SERVERLESS C L O U D F U N C T I O N S * Figure borrowed from "Serverless Computation with OpenLambda", by Hendrickson et al. 2018.
  • 10. 10 Execution without managing resource allocation From x86 machine code to high-level programming languages CODE Is stateless Event driven Fine-grain autoscaling Decoupled from storage COMPUTATION Resources used instead of resources allocated 100 ms increment BILLING SERVERLESS A N O V E R V I E W
  • 11. 11 APACHE PULSAR R E A L - T I M E M E S S A G I N G + S T O R A G E M O D E L U P D AT E W I T H O U T R E S TA R T I N G T H E A P P L I C AT I O N N AT I V E S U P P O R T F O R S E R V E R L E S S S T R E A M F U N C T I O N S A N O V E R V I E W
  • 12. 12 APACHE PULSAR T E R M I N O L O G Y Apache Pulsar Cluster Product Safety ETL Fraud Detection Topic-1 Account History Topic-2 User Clustering Topic-1 Risk Classification MarketingCampaigns ETL Topic-1 Budgeted Spend Topic-2 Demographic Classification Topic-1 Location Resolution Data Serving Microservice Topic-1 Customer Authentication Tenants Namespaces Topics
  • 13. 13 APACHE PULSAR DURABILITY MULTI-TENANCY TIERED STORAGE UNIFIED MESSAGING & QUEUING HIGHLY SCALABLE K E Y C H A R AC T E R I S T I C S
  • 14. 14 APACHE PULSAR I N D E P E N D E N T S C A L A B I L I T Y I N S TA N T S C A L A B I L I T Y F A U L T TO L E R A N C E A R C H I T E C T U R A L D E S I G N Bookie Bookie Bookie Broker Broker Broker Producer Consumer
  • 15. 15 APACHE PULSAR W R I T E TA I L I N G R E A D S C ATC H U P R E A D S AC C E S S PAT T E R N S
  • 16. 16 PULSAR FUNCTIONS S I M P L E S T P O S S I B L E A P I F U N C T I O N O R A P R O C E D U R E S U P P O R T F O R M U L T I - L A N G U A G E ( J a v a & P y t h o n ) F L E X I B L E R U N T I M E I N T R O D U C T I O N
  • 17. 17 PULSAR FUNCTIONS I N T R O D U C T I O N Pulsar Function i/p topic 1 i/p topic 2 i/p topic 3 o/p topic 1 o/p topic 2 o/p topic 3
  • 18. 18 PULSAR FUNCTIONS I N T R O D U C T I O N import java.util.function.Function; public class ExclamationFunction implements Function<String, String> { @Override public String apply(String input) { return input + "!"; } } Exclamation Functioni/p topic 1 o/p topic 2 strings strings
  • 19. 19 PULSAR FUNCTIONS AT L E A S T O N C E AT M O S T O N C E E X A C T L Y O N C E P R O C E S S I N G G UA R A N T E E S
  • 20. 20 PULSAR FUNCTIONS D Y N A M I C D ATA R O U T I N G D ATA F I L T E R I N G D ATA E N R I C H M E N T E V E N T P R O C E S S I N G D E S I G N PAT T E R N S A L E R T S A N D T H R E S H O L D S D ATA T R A N S F O R M AT I O N S C O U N T I N G W I T H W I N D O W S
  • 21. 21 T H R E A D S P R O C E S S E S C O N T A I N E R S PULSAR FUNCTIONS D E P L O Y M E N T
  • 22. 22 PULSAR FUNCTIONS D E P L O Y M E N T Broker 1 Worker Function wordcount-1 Function transform-2 Broker 1 Worker Function transform-1 Function dataroute-1 Broker 1 Worker Function wordcount-2 Function transform-3 Node 1 Node 2 Node 3
  • 23. 23 PULSAR FUNCTIONS D E P L O Y M E N T Worker Function wordcount-1 Function transform-2 Worker Function transform-1 Function dataroute-1 Worker Function wordcount-2 Function transform-3 Node 1 Node 2 Node 3 Broker 1 Broker 2 Broker 3 Node 4 Node 5 Node 6
  • 24. 24 PULSAR FUNCTIONS D E P L O Y M E N T - K U B E R N E T E S Function wordcount-1 Function transform-1 Function transform-3 Pod 1 Pod 2 Pod 3 Broker 1 Broker 2 Broker 3 Pod 7 Pod 8 Pod 9 Function dataroute-1 Function wordcount-2 Function transform-2 Pod 4 Pod 5 Pod 6
  • 25. 25 PULSAR FUNCTIONS D ATA T R A N S F O R M AT I O N D ATA E X T R A C T I O N C O N T E N T R O U T I N G & F I L T E R I N G U S E C A S E S I N DATA E N G I N E E R I N G
  • 27. * Figure borrowed from "A Case for Serverless Machine Learning", by Carreira et al. 2018. * D I S T R I B U T E D M L Hundreds of concurrent workers Map to serverless functions Backend manages compute resources and task scheduling ML PIPELINE T R A I N I N G 27
  • 28. ML PIPELINE I N F E R E N C E G U I D I N G D E C I S I O N M A K I N G Calls for less computational power than training RESTful endpoint for Functions ✦ Available via HTTP GET request Model size ✦ Tens of MB to over a GB Cold start → Warm start ✦ Function reuse Backend manages compute resources and task scheduling 28
  • 29. 29 Model Serving Pulsar Function Model Stream Data Stream model i/p topic data i/p topic Inference Stream Inference o/p topic MODEL SERVING
  • 30. 30 Model Stream Data Stream model i/p topic data i/p topic Inference Stream inference o/p topic MODEL MODEL SERVING
  • 31. 31 Model Stream Data Stream model i/p topic data i/p topic Inference Stream inference o/p topicMODELold MODELnew MODEL SERVING
  • 32. 32 Model Stream Data Stream model i/p topic data i/p topic Inference Stream inference o/p topic MODEL User Defined Metrics Recall Precision MODEL SERVING M E T R I C S
  • 33. DATA SKETCHES Approximate ✦ Probabilistic Bounds Accuracy-Speed Trade-off One Pass Incremental Low memory footprint A S M O D E L S 33
  • 34. 34 FLAVORS O F DATA S K E TC H E S S A M P L I N G C A R D I N A L I T YF I L T E R I N G F R E Q U E N T E L E M E N T S A N O M A L Y D E T E C T I O N Q U A N T I L E S
  • 35. 35 FILTERING B L O O M F I L T E R MEMBERSHIP import org.apache.pulsar.functions.api.Context; import org.apache.pulsar.functions.api.Function; import com.clearspring.analytics.stream.membership.BloomFilter; public class BloomFilterFunction implements Function<String, Void> { BloomFilter filter = new BloomFilter(20, 20); Void process(String input, Context context) throws Exception { if (!filter.isPresent(input)) { filter.add(input); // Route to “not seen” topic context.publish(“notSeenTopic”, input); } return null; } }
  • 36. 36 FREQUENT ELEMENTS C O U N T - M I N S K E T C H FREQUENCY import org.apache.pulsar.functions.api.Context; import org.apache.pulsar.functions.api.Function; import com.clearspring.analytics.stream.frequency.CountMinSketch; public class CountMinFunction implements Function<String, Void> { CountMinSketch sketch = new CountMinSketch(20, 20, 128); Void process(String input, Context context) throws Exception { sketch.add(input, 1); // Calculates bit indexes and performs +1 long count = sketch.estimateCount(input); // React to the updated count return null; } }
  • 37. 37 CARDINALITY H Y P E R L O G L O G # UNIQUE ELEMENTS import org.apache.pulsar.functions.api.Context; import org.apache.pulsar.functions.api.Function; import io.airlift.stats.cardinality.HyperLogLog; public class HyperLogLogFunction implements Function<Integer, Void> { HyperLogLog hll = HyperLogLog.newInstance(2048); Void process(Integer value, Context context) throws Exception { hll.add(value); Integer numDistinctElements = hll.cardinality(); // Do something with the distinct elements } }
  • 38. 38 SEVERLESS ML G P U S U P P O R T Key for Deep Learning F A S T S H A R E D S T O R A G E Functions do not talk to each other Example: Crail*, Pocket E X T E N D I N G T O T H E E D G E Functions running on ✦ Smartphones ✦ IoT Devices G O I N G F O R WA R D * https://crail.apache.org/
  • 39. 39 “It is better to fail in originality than to succeed in imitation.” H e r m a n M e l v i l l e
  • 40. 40 P R O J E C T D E S C R I P T I O N
  • 42. 42 Efficient Construction of Approximate Ad-Hoc ML models Through Materialization and Reuse [Hasani et al. 2018] READINGS A Case for Serverless Machine Learning [Carreira et al. 2018] Pocket: Elastic ephemeral storage for serverless analytics [Klimovic et al. 2018] Serving deep learning models in a serverless platform [Ishakian et al. 2018] PRETZEL: Opening the Black Box of Machine Learning Prediction Serving Systems [Lee et al. 2018] Cloud Programming Simplified: A Berkeley View on Serverless Computing [Jona et al. 2019]
  • 43. 43 Serverless Is More: From PaaS to Present Cloud Computing [Eyk et al. 2018] READINGS Serverless Computing: Current Trends and Open Problems [Baldini et al. 2018] Clipper: A low-latency online prediction serving system [Crankshaw et al. 2017] Borg, Omega, and Kubernetes [Burns et al. 2016] Serverless Computation with OpenLambda [Hendrickson et al. 2016] TensorFlow Serving [https://www.tensorflow.org/tfx/guide/serving]
  • 44. 44 Architecture of a Serverless Machine Learning Model [https://cloud.google.com/solutions/architecture-of-a-serverless-ml-model] READINGS Pure serverless machine learning inference with AWS Lambda and Layers [https://medium.com/merapar/pure-serverless-machine-learning-inference-with-aws-lambda-and-layers-979702d9ae49]