Slide 1

Slide 1 text

Serverless Functions Azure, AWS, GCP Cloud Republic Event | Utrecht | October 30, 2019

Slide 2

Slide 2 text

• Software developer • Cloud • Serverless • Functional programming • Microsoft Azure MVP https://mikhail.io @MikhailShilkov Mikhail Shilkov

Slide 3

Slide 3 text

Function-as-a-Service Cloud Offerings

Slide 4

Slide 4 text

Hosting Plans Configurability Languages Programming Model Concurrency Isolation Cost Orchestrations Cold Starts Scalability Conclusions Q&A

Slide 5

Slide 5 text

Hosting Plans

Slide 6

Slide 6 text

Azure Functions

Slide 7

Slide 7 text

AWS Lambda and Google Functions

Slide 8

Slide 8 text

Configurability

Slide 9

Slide 9 text

Azure Functions Consumption

Slide 10

Slide 10 text

AWS Lambda Memory Allocation

Slide 11

Slide 11 text

GCF Memory Allocation

Slide 12

Slide 12 text

Azure Functions Premium

Slide 13

Slide 13 text

Programming Languages

Slide 14

Slide 14 text

Language Azure Functions AWS Lambda Google Cloud Functions .NET (C#/F#) GA GA - Node.js (JS/TS) GA GA GA JVM (Java) GA GA - Python GA (Linux only) GA GA PowerShell Preview GA - Go - GA GA Ruby - GA - Comparison Table

Slide 15

Slide 15 text

Programming Model

Slide 16

Slide 16 text

Azure Functions: Triggers and Bindings [FunctionName("MyFunc")] public static void Work( [TimerTrigger("0 */10 * * * *")] TimerInfo timer, [Blob("filename")] Stream stream, [Queue("myqueue")] out string message) { // body }

Slide 17

Slide 17 text

AWS: JSON Input and Output exports.handler = async (event) => { const response = { statusCode: 200, body: JSON.stringify('Hello from Lambda!'), }; return response; };

Slide 18

Slide 18 text

ASP.NET Core on AWS Lambda public class LambdaFunction : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction { protected override void Init(IWebHostBuilder builder) { builder .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup() .UseApiGateway(); } }

Slide 19

Slide 19 text

GCP: Express-like API exports.helloWorld = (req, res) => { let message = req.query.message || req.body.message || 'Hello World!'; res.status(200).send(message); };

Slide 20

Slide 20 text

Deployment Artifacts

Slide 21

Slide 21 text

Concurrency and Isolation

Slide 22

Slide 22 text

Resource Pool

Slide 23

Slide 23 text

Resource Pool

Slide 24

Slide 24 text

Resource Pool

Slide 25

Slide 25 text

Resource Pool

Slide 26

Slide 26 text

Resource Pool

Slide 27

Slide 27 text

Resource Pool

Slide 28

Slide 28 text

Resource Pool

Slide 29

Slide 29 text

Client Value Resource Utilization

Slide 30

Slide 30 text

Tradeoff

Slide 31

Slide 31 text

Server, VM, container, process, ...

Slide 32

Slide 32 text

Server, VM, container, process, ... VM VM

Slide 33

Slide 33 text

Server, VM, container, process, ... VM VM

Slide 34

Slide 34 text

Server, VM, container, process, ... VM VM

Slide 35

Slide 35 text

Server, VM, container, process, ... VM VM

Slide 36

Slide 36 text

Azure Functions 12

Slide 37

Slide 37 text

Legacy of App Service

Slide 38

Slide 38 text

Legacy of App Service

Slide 39

Slide 39 text

App Service: scalability

Slide 40

Slide 40 text

App Service: scalability

Slide 41

Slide 41 text

Function App Consumption Plan

Slide 42

Slide 42 text

Isolation Layers

Slide 43

Slide 43 text

Simultaneous Executions

Slide 44

Slide 44 text

Simultaneous Executions

Slide 45

Slide 45 text

Simultaneous Executions

Slide 46

Slide 46 text

Simultaneous Executions

Slide 47

Slide 47 text

AWS Lambda 22

Slide 48

Slide 48 text

AWS Lambda

Slide 49

Slide 49 text

AWS Lambda

Slide 50

Slide 50 text

AWS Lambda

Slide 51

Slide 51 text

Integrating with AWS Lambda

Slide 52

Slide 52 text

Simultaneous Executions in AWS Lambda

Slide 53

Slide 53 text

Isolation Layers

Slide 54

Slide 54 text

Simultaneous Executions in AWS Lambda

Slide 55

Slide 55 text

Simultaneous Executions in AWS Lambda

Slide 56

Slide 56 text

Simultaneous Executions in AWS Lambda

Slide 57

Slide 57 text

• • • • AWS Firecracker

Slide 58

Slide 58 text

Isolation Layers with Firecracker

Slide 59

Slide 59 text

«Naive» Function Composition

Slide 60

Slide 60 text

Statistical Multiplexing

Slide 61

Slide 61 text

Google Cloud Functions 31

Slide 62

Slide 62 text

Google Cloud Functions

Slide 63

Slide 63 text

Cost

Slide 64

Slide 64 text

Nominal Pricing

Slide 65

Slide 65 text

Nuances

Slide 66

Slide 66 text

Azure Simultaneous Executions

Slide 67

Slide 67 text

AWS Lambda: HTTP Integration

Slide 68

Slide 68 text

AWS Lambda: HTTP Integration

Slide 69

Slide 69 text

Orchestration

Slide 70

Slide 70 text

Azure Logic Apps

Slide 71

Slide 71 text

AWS Step Functions

Slide 72

Slide 72 text

Azure Durable Functions public static async Task Sequential(DurableOrchestrationContext context) { var conf = await context.CallActivityAsync ("BookConference", "ServerlessDays"); var flight = await context.CallActivityAsync ("BookFlight", conf.Dates); await context.CallActivityAsync("BookHotel", flight.Dates); }

Slide 73

Slide 73 text

Performance and Scalability

Slide 74

Slide 74 text

Ideal Scalability: Throughput

Slide 75

Slide 75 text

Ideal Scalability: Latency

Slide 76

Slide 76 text

Customer Value Cloud Resource Utilization

Slide 77

Slide 77 text

Cold Starts

Slide 78

Slide 78 text

Example: Loading a map

Slide 79

Slide 79 text

Example: Loading a map

Slide 80

Slide 80 text

Example: Loading a map

Slide 81

Slide 81 text

Cold Start

Slide 82

Slide 82 text

Warm Start

Slide 83

Slide 83 text

Period Before a Subsequent Cold Start

Slide 84

Slide 84 text

Cold Starts: Language Comparison

Slide 85

Slide 85 text

Dependencies Add to Cold Start

Slide 86

Slide 86 text

Fighting Cold Starts: Azure [FunctionName("Warmer")] public static void WarmUp( [TimerTrigger("0 */10 * * * *")] TimerInfo timer) { // No need to do anything }

Slide 87

Slide 87 text

AWS: Single instance warming

Slide 88

Slide 88 text

AWS: Multiple instance warming

Slide 89

Slide 89 text

ETL AT SCALE: Asynchronous data processing

Slide 90

Slide 90 text

Async Pipelines

Slide 91

Slide 91 text

Experiments with Queues

Slide 92

Slide 92 text

AWS Lambda Processing 100k SQS Messages

Slide 93

Slide 93 text

GCF Processing 100k Pub/Sub Messages

Slide 94

Slide 94 text

Azure Functions Processing 100k Queue Messages

Slide 95

Slide 95 text

CPU-intensive workload on AWS Lambda

Slide 96

Slide 96 text

CPU-intensive workload on Google Cloud Functions

Slide 97

Slide 97 text

CPU-intensive workload on Azure Functions

Slide 98

Slide 98 text

AWS Processing Speed per Reserved RAM

Slide 99

Slide 99 text

HTTP AT SCALE: Serving traffic of StackOverflow

Slide 100

Slide 100 text

Serving StackOverflow-like traffic

Slide 101

Slide 101 text

Requests/sec during the load test

Slide 102

Slide 102 text

0 200 400 600 800 1000 1200 Azure Functions: Response Percentiles (ms)

Slide 103

Slide 103 text

0 200 400 600 800 1000 1200 Azure Functions: Response Percentiles (ms)

Slide 104

Slide 104 text

0 200 400 600 800 1000 1200 Azure Functions: Instances

Slide 105

Slide 105 text

Google Functions: Response Percentiles (ms)

Slide 106

Slide 106 text

Google Functions: Response Percentiles (ms)

Slide 107

Slide 107 text

0 200 400 600 800 1000 1200 Google Functions: Instances

Slide 108

Slide 108 text

0 200 400 600 800 1000 1200 AWS Lambda: Response Percentiles (ms)

Slide 109

Slide 109 text

0 200 400 600 800 1000 1200 AWS Lambda: Response Percentiles (ms)

Slide 110

Slide 110 text

0 200 400 600 800 1000 1200 AWS Lambda: Instances

Slide 111

Slide 111 text

So, What Should You Choose?

Slide 112

Slide 112 text

• • • • Follow-up reading (1)

Slide 113

Slide 113 text

• • • Follow-up reading (2)

Slide 114

Slide 114 text

No content