architectural implications of faascomputing...openwhisk couchdb post rich analytics quick insights...

24
Architectural Implications of FaaS Computing Mohammad Shahrad, Jonathan Balkind, and David Wentzlaff Wednesday, October 30, 2019 @MShahrad https://mshahrad.github.io/

Upload: others

Post on 30-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Architectural Implications of FaaS Computing

Mohammad Shahrad, Jonathan Balkind, and David Wentzlaff

Wednesday, October 30, 2019

@MShahrad

https://mshahrad.github.io/

Page 2: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

2

Function-as-a-Service (FaaS)Serverless Computing

Auto-scaling &

transparentoperation

Applicationscomposed of

functionsAmazon Lambda Azure Functions

Google CloudFunctions

IBM CloudFunctions

Page 3: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

FaaS is like a flying rhino!

• Neither a bird (native function)• Too much overhead compared to

native function execution

• Nor a rhino (VM)• Being small and short-lived makes

them hard to provision

3Source: https://www.flickr.com/photos/1grandpoobah/7902346828/in/photostream/

Page 4: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

FaaS Differs From Prior Cloud Offerings

4

Just a few:• Short function executions• High concurrency (with inefficient isolation)• Fine-grained pricing based on execution time, memory, and

request counts• Developer has less control on provisioning

Page 5: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Prior Work

5

External characterization and reverse-engineering

Building new applications / mapping existing applications

Better isolation/virtualization mechanisms (safe containers, light virtual machines)

Page 6: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Our Initial Goal: New Architectural Features to Better Support FaaS

6

No Benchmark

No Clear Testing & Profiling Methodology

Too Complex of a System

Let’s gather some!

Let’s build one!

Let’s try to understand it first!

Page 7: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Diving deep into an open source serverless platform.

• A complete open-sourced industry-grade (IBM) FaaSplatform

• Functions run in containers• Functions can be in Python, Node.js, Scala, Java, Go,

Ruby, Swift, PHP, .Net, and Rust• Or the developer can provide a Docker container

7

Page 8: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

8

We built FaaSProfiler for testing and profiling.

Synthetic Workload Invoker

Workload Analyzer

Comparative Analyzer

FaaS Platform

OpenWhisk

CouchDB

Post

Rich AnalyticsQuick Insights

Data Archives

{;}

JSON

Post

Get

NGINX

Controller

Kafka

Invoker

FaaSProfiler

ConfigFile • Automated function invocations

(single JSON file):• Synthetic distributions

• Specified traces

• Uses standard profiling tools:Perf, PQoS, Blktrace, etc.

• Easy analysis and comparison

https://github.com/PrincetonUniversity/faas-profiler

Page 9: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Benchmarks and Test Setup

Benchmarks:• 5 representative applications• 28 Python microbenchmarks

Test server:• Intel Xeon E5-2620 v4• 8-cores, 16-threads• 20MB Last-Level Cache• 16GB 2133MHz DDR4 (single-channel)

9

FaaSBenchmark Runtime

autocomplete NodeJS

markdown-to-HTML Python

img-resize NodeJS

sentiment-analysis Python

ocr-img NodeJS + binary

Page 10: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Understanding The Performance Criteria

Page 11: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

How about for FaaS functions?

For native functions, execution time is an accepted measure of performance.

11

Execution Time Latency Throughput

End UserDeveloper Provider

Page 12: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Server Capacity & Latency Modes

■ Over-invoked

■ Capacity

■ Balanced

■ Under-invoked

12

Input > Capacity

Input = Capacity

Input < Capacity

Input << Capacity

Page 13: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

13

Breakdown of Latency

1. Initialization Time

2. Wait Time in the Queue

3. Execution Time

Non-trivial overhead

Page 14: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

14

Interesting Architectural Findings

2. Branch Prediction

1. Last-level Cache (LLC) Requirement

3. Memory Bandwidth Consumption

Page 15: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Last-Level Cache (LLC)

15

Shared L3 (LLC)

L2

iL1 dL1

Core N

Memory~50-70ns

~2-5ns

https://www.anandtech.com/show/2960/2

http://www.guru3d.com/articles-pages/core-i7-5960x-5930k-and-5820k-processor-review,2.html

Critical for Performance

Vary Expensive (SRAM on CPU)

L2

iL1 dL1

Core 1

Page 16: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

We observed low LLC requirements.

16

Used Intel Cache Allocation Technology (CAT).

Low Demand

from Functions

Low Demand from

Platform Components

Page 17: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Others have also reported decreasing LLC requirement for emerging cloud workloads.

17

• Scale out workloads [Ferdman et al., ASPLOS ‘12]• Latency-critical cloud workloads [Chen et al., ASPLOS ‘19]• Microservices [Gen et al., ASPLOS ‘19]

Long-term Opportunity

Princeton Piton Processor UC Davis KiloCore

More cores, less LLCShort-term OpportunityPartition the LLC in favor of cache-sensitive workloads.

Page 18: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Branch Prediction Performance

18MPKI: Misses per Kilo Instructions

MPKI does not vary with invocation rate if containers kept alive.

Functions have a distinct behavior.

convergence

Page 19: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Longer execution helps with branch misses.

19

Shorter functions have higher MPKI.[~20x variations]

Simulations revealed the reason.

Page 20: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Short FaaS Function Lifetimes vs.Conventional Microarchitectural Expectation

20

• Conventional expectation: programs run for long enough to train the predictors.

• Short deeply-virtualized functions are not a good fit to this model.

Revised branch predictors for:

• Retaining prediction states at the container- or application-level

• Faster training

Opportunity

Page 21: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Memory Bandwidth Consumption

21

Various demands make it hard to co-locate.

• Heavy payload• Short execution time

• Medium payload• Long execution time

• Light payload• Very short execution time

Page 22: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

Per-Invocation Memory Bandwidth Usage

22

Markdown Application

4x

• Pausing/unpausing containers increases the bandwidth usage

• Bandwidth usage noticeably higher compared to native executions

Page 23: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

The server behavior should be carefully taken into account when designing new services.

23

NativeExecution

Container

Cold Start

Branch MPKI

Queueing

Scheduling

Network

Memory BW

Interference

Up to 20xslowdown

>10x exec timefor short functions(500ms cold start)

20x MPKI forshort functions

6x variation due toinvocation pattern

35% decrease in IPCdue to interference

Serv

er(th

is pa

per)

Plat

form

Man

agem

ent

(prio

r wor

k)

Page 24: Architectural Implications of FaaSComputing...OpenWhisk CouchDB Post Rich Analytics Quick Insights Data Archives {;} JSON Post Get NGINX Controller Kafka Invoker FaaSProfiler Config

FaaSProfilerPaper PDF