Serverless Performance
- n a Budget
Erwin van Eyk
Serverless Performance on a Budget Erwin van Eyk The central - - PowerPoint PPT Presentation
Serverless Performance on a Budget Erwin van Eyk The central trade-off in serverless computing High Performance Infinite scaling High availability Low latency 2 The central trade-off in serverless computing High Performance Low
Erwin van Eyk
“Infinite” scaling High availability Low latency
2
“Infinite” scaling High availability Low latency
No costs when idle No operational cost Granular billing
2
“Infinite” scaling High availability Low latency
No costs when idle No operational cost Granular billing
How can we optimize the performance-cost trade-off?
2
Anatomy of a Functions-as-a-Service (FaaS) platform
pods and other resources
3
Anatomy of a FaaS platform
4
Anatomy of a FaaS platform: Fission (without optimizations)
5
Anatomy of a FaaS platform: cold start
6
Anatomy of a FaaS platform: cold start
6
Anatomy of a FaaS platform: cold start 1
Trigger function deployment
6
Anatomy of a FaaS platform: cold start 1
Trigger function deployment Fetch function metadata
2
6
Anatomy of a FaaS platform: cold start 1
Trigger function deployment
3
kubectl create Fetch function metadata
2
6
Anatomy of a FaaS platform: cold start 1
Trigger function deployment
3
kubectl create
4
Wait for K8S to deploy function Fetch function metadata
2
6
Anatomy of a FaaS platform: cold start 1
Trigger function deployment
3
kubectl create
4
Wait for K8S to deploy function
5
Send request Fetch function metadata
2
6
Anatomy of a FaaS platform: cold start 1
Trigger function deployment
3
kubectl create
4
Wait for K8S to deploy function
5
Send request Response
6
Fetch function metadata
2
6
Anatomy of a FaaS platform: cold start 1
Trigger function deployment
3
kubectl create
4
Wait for K8S to deploy function
5
Send request Response
6 7
Fetch function metadata
2
6
Anatomy of a FaaS platform: warm execution
7
Anatomy of a FaaS platform: warm execution
7
Anatomy of a FaaS platform: warm execution
7
5
Send request
Anatomy of a FaaS platform: warm execution
7
5
Send request Response
6
Anatomy of a FaaS platform: warm execution
7
5
Send request Response
6 7
8
8
Trigger deployer
8
Trigger deployer
Fetch function metadata
8
Trigger deployer
Fetch function metadata Deploy Pod
8
Trigger deployer
Fetch function metadata Fetch function Deploy Pod
8
Trigger deployer
Fetch function metadata Fetch function Deploy Pod Deploy function
8
Route request
Trigger deployer
Fetch function metadata Fetch function Deploy Pod Deploy function
8
Route request
Trigger deployer
Fetch function metadata Fetch function Deploy Pod Deploy function Function Execution
8
Route request
Trigger deployer
Fetch function metadata Fetch function Deploy Pod Deploy function Function Execution Route request
8
Route request
Trigger deployer
Fetch function metadata Fetch function Deploy Pod Deploy function Function Execution Route request Function Execution
Cold starts matter!
Wang, Liang, et al. "Peeking Behind the Curtains of Serverless Platforms." 2018 USENIX ATC, 2018.
Coldstart latency (in ms) over 168 hours
9
500 ms 3600 ms 180 ms
10
Trigger deployer Fetch function metadata Deploy pod Deploy function Function Execution Route request
11
Optimization 1
Fetch function
Function Isolation vs. Function Reuse
12
Full Isolation Full resource reuse
Function Instance Request Response Function Instance Request Response Function Instance Request Response Function Instance Requests Responses
13
FaaS platform with function reusing
14
short keep-alives Less idle resources Long keep-alive More warm executions
15
16
Optimization 2
Route request Trigger deployer Fetch function metadata Fetch function Function Execution Deploy function Deploy pod
Resources Function Runtime Resources
Function Instance = Runtime + Function
17
Function Instance Function Runtime Resources Runtime deployment Function deployment
Resource Pooling
Pool of 3 function runtimes Fn Runtime Fn Runtime Fn Runtime 2 function runtimes → function instances Pool rebalancing Fn Instance Fn Instance Fn Runtime Fn Runtime Fn Runtime Fn Runtime Fn Instance Fn Instance
18
FaaS platform with function runtime pooling
19
Performance Minimize cost Large pool Handle high concurrency Increases resource overhead Minimal pool Fast pool exhaustion Minimize pool; less idle resources
20
Route request Trigger deployer Fetch function metadata Deploy pod Deploy function Function Execution Fetch function
21
Optimization 3
Function prefetching
22
Fetch function sources proactively and place them near resources to reduce function transfer latency
Abad, Cristina L. et al. "Package-Aware Scheduling of FaaS Functions." Companion of the 2018 ACM/SPEC International Conference on Performance Engineering. ACM, 2018.
Prefetching Rack/Machine-level Function-level Remote Storage Cluster-level
Prefetching Rack/Machine-level Function-level Remote Storage Cluster-level
Higher latency Less storage costs Lower latency More storage costs
FaaS platform with prefetching
25
Route request Trigger deployer Fetch function metadata Fetch function Deploy pod Deploy function Function Execution
26
Optimization 4
Anticipate function executions by deploying functions predictively.
27
van Eyk, Erwin, et al. "A SPEC RG CLOUD Group's Vision on the Performance Challenges of FaaS Cloud Architectures." Companion of the 2018 ACM/SPEC International Conference on Performance Engineering. ACM, 2018.
28
28
Active field of research (autoscaling, predictive caches…) Common approaches
29
Optimistic prewarming Low threshold Misprediction: resources wasted Ping hack Pessimistic prewarming High threshold Misprediction: no prewarm
More performance due to prewarming Less costs due to less mispredicted prewarming
30
monitorable, fault-tolerant function compositions with low overhead.
image-recognizer translate-text image-resizer
⼽戉弗
combine-image-text
Sequential execution Parallel execution
validate-image
31
Function composition...
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
Fission Workflows supports horizon-based prewarming Not started Prewarmed Finished Started
32
...with prewarming
FaaS platform with workflow-based prewarming
33
Four techniques key to performance in serverless:
Each makes a trade-off between performance and cost. Serverless: Pay not just for what you use - pay for what you need.
34
http://fission.io + https://github.com/fission http://fission.io/workflows Slack http://slack.fission.io/ Twitter @fissionio Thanks!
35
Erwin van Eyk Software Engineer, Platform9 Chair, SPEC CLOUD RG Serverless @erwinvaneyk erwin@platform9.com
36
van Eyk, Erwin, et al. "A SPEC RG CLOUD Group's Vision on the Performance Challenges of FaaS Cloud Architectures." Companion of the 2018 ACM/SPEC International Conference on Performance Engineering. ACM, 2018.
37
FaaS platform with optimizations
38
Anatomy of a FaaS platform
Build time Developer creates, manages the functions Run time User and external systems events trigger function executions. van Eyk, E., Iosup, A., Seif, S., & Thömmes, M. (2017, December). The SPEC cloud group's research vision on FaaS and serverless architectures. In Proceedings
39
Fission Workflows supports initial horizon-based prewarming
Not started Prewarmed Finished Started
40
Function composition… (pdf version)
Fission Workflows supports initial horizon-based prewarming
Not started Prewarmed Finished Started
40
Function composition… (pdf version)
Fission Workflows supports initial horizon-based prewarming
Not started Prewarmed Finished Started
40
Function composition… (pdf version)