Slide 1

Slide 1 text

Digital Performance Serverless Performance By Andy Still

Slide 2

Slide 2 text

Andy Still : Technical Director & Founder, Intechnica Web: www.intechnica.co.uk Email: [email protected] Twitter: @andy_still / @intechnica Blog: http://www.internetperformanceexpert.com/ http://www.intechnica.co.uk/web-performance-warrior.aspx http://oreil.ly/2cJLxZh http://oreil.ly/2ce2ghE

Slide 3

Slide 3 text

Digital Performance What is Serverless?

Slide 4

Slide 4 text

History

Slide 5

Slide 5 text

History

Slide 6

Slide 6 text

History

Slide 7

Slide 7 text

History

Slide 8

Slide 8 text

History – Going Virtual

Slide 9

Slide 9 text

History – into the cloud

Slide 10

Slide 10 text

History – into the cloud

Slide 11

Slide 11 text

Now : Serverless

Slide 12

Slide 12 text

Digital Performance What is AWS Lambda?

Slide 13

Slide 13 text

Digital Performance What it isn’t

Slide 14

Slide 14 text

A lamb

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

A lamborghini

Slide 17

Slide 17 text

A C# Lambda Expression customers.Where(c => c.City == "London");

Slide 18

Slide 18 text

Digital Performance So, what is it then?

Slide 19

Slide 19 text

Digital Performance A standalone piece of code that runs in a shared infrastructure

Slide 20

Slide 20 text

Important Lesson…

Slide 21

Slide 21 text

It is not Serverless…

Slide 22

Slide 22 text

It does still run on servers…

Slide 23

Slide 23 text

You just don’t need to know about them

Slide 24

Slide 24 text

Better name: Function-As-A-Service

Slide 25

Slide 25 text

A standalone piece of code that runs in a shared infrastructure Code is managed and deployed as individual functions Triggered by external events

Slide 26

Slide 26 text

A standalone piece of code that runs in a shared infrastructure You are only responsible for your code – the environment is outside your control No control over compute resources used You specify the amount of memory you want assigned to your function

Slide 27

Slide 27 text

Multiple Supported Languages Can develop in 4 supported languages Java Python Node C#

Slide 28

Slide 28 text

Digital Performance Benefits

Slide 29

Slide 29 text

Benefits No servers to manage Code scales to your requirements Can execute many times in parallel Only pay for execution time Tracked down to nearest 100ms Isolation of functionality

Slide 30

Slide 30 text

Digital Performance How does it work?

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Digital Performance How can it be triggered?

Slide 33

Slide 33 text

Triggers Other AWS services S3 Dynamo DB Kinesis SNS Cloudwatch External requests Via AWS API Gateway E.g. triggered from website Scheduled Proactive or reactive

Slide 34

Slide 34 text

Digital Performance What’s it for?

Slide 35

Slide 35 text

Real time file processing

Slide 36

Slide 36 text

Real time Data Processing

Slide 37

Slide 37 text

Data Transformation

Slide 38

Slide 38 text

Deployment tasks  Plumbing for a deployment pipeline  Platform transforms  Backups  etc

Slide 39

Slide 39 text

Backends

Slide 40

Slide 40 text

Digital Performance Performance – is it ready for prime time?

Slide 41

Slide 41 text

Serverless does not mean no servers… Just you don’t have to worry about servers

Slide 42

Slide 42 text

Whilst you can simplify the management of servers and environments…

Slide 43

Slide 43 text

The requirement to understand and analyse performance data is as important as ever

Slide 44

Slide 44 text

Digital Performance Performance Challenges

Slide 45

Slide 45 text

Standard server performance metrics are no longer available. Only stats available relate to external execution times

Slide 46

Slide 46 text

All functions have to be written to be idempotent - no cached data or files - no connection pooling

Slide 47

Slide 47 text

Digital Performance Overheads

Slide 48

Slide 48 text

Understand other overheads as well as the server side request… Look at RUM / Synthetic data

Slide 49

Slide 49 text

Non-server side overhead https://blog.newrelic.com/2017/01/11/aws-lambda-cold-start-optimization/

Slide 50

Slide 50 text

Digital Performance Cold Start

Slide 51

Slide 51 text

Functions have to create environment on first use Known as a Cold Start

Slide 52

Slide 52 text

Environment has to be re- created after period of no activity or if underlying infrastructure needs to expand under load.

Slide 53

Slide 53 text

After approx 5 mins of inactivity or 2-4 hours regardless of activity

Slide 54

Slide 54 text

Performance of regular v Intermittent Functions https://blog.newrelic.com/2017/01/11/aws-lambda-cold-start-optimization/

Slide 55

Slide 55 text

Each cold start Lambda execution adds significant overhead

Slide 56

Slide 56 text

Cold start overhead varies by language

Slide 57

Slide 57 text

Cold start overhead can be mitigated by minimising amount of packages included in the build

Slide 58

Slide 58 text

Easily mitigated with scheduled task

Slide 59

Slide 59 text

Digital Performance Serverless Performance and Economics

Slide 60

Slide 60 text

Serverless is a perfect economic reflection of good performance

Slide 61

Slide 61 text

Serverless is a perfect economic reflection of good performance Dan North

Slide 62

Slide 62 text

Serverless Cost Model • Number of Executions • Memory allocated • Execution Time 3 Elements

Slide 63

Slide 63 text

Execution is charged in 100ms blocks – optimise performance to meet these block limits

Slide 64

Slide 64 text

As always… evaluate cost savings against cost of optimisation

Slide 65

Slide 65 text

Digital Performance Optimising Memory size

Slide 66

Slide 66 text

Memory is the only dial available – adjusting memory also adjusts the CPU and other server settings

Slide 67

Slide 67 text

Example: Low memory, High CPU task Task: In local testing, uses <50mb of memory https://serverless.zone/my-accidental-3-5x-speed-increase-of-aws-lambda-functions-6d95351197f3#.q18h6eg9k

Slide 68

Slide 68 text

Example: Low memory, High CPU task REPORT Duration: 2120.67 ms Billed Duration: 2200 ms Memory Size: 128 MB REPORT Duration: 2778.51 ms Billed Duration: 2800 ms Memory Size: 128 MB REPORT Duration: 2185.11 ms Billed Duration: 2200 ms Memory Size: 128 MB REPORT Duration: 1883.18 ms Billed Duration: 1900 ms Memory Size: 128 MB REPORT Duration: 353.52 ms Billed Duration: 400 ms Memory Size: 1536 MB REPORT Duration: 340.44 ms Billed Duration: 400 ms Memory Size: 1536 MB REPORT Duration: 356.91 ms Billed Duration: 400 ms Memory Size: 1536 MB REPORT Duration: 280.49 ms Billed Duration: 300 ms Memory Size: 1536 MB REPORT Duration: 336.75 ms Billed Duration: 400 ms Memory Size: 1536 MB Before: After: Increasing memory improved performance 7x

Slide 69

Slide 69 text

Digital Performance Consistency of Performance

Slide 70

Slide 70 text

Lambda functions deliver inconsistent performance https://blog.symphonia.io/the-occasional-chaos-of-aws-lambda-runtime-performance-880773620a7e#.s1vd0mr6f

Slide 71

Slide 71 text

Regular executions at varying memory size infrastructure

Slide 72

Slide 72 text

Sorted into response time order

Slide 73

Slide 73 text

What does this mean? Documented performance levels are WORST CASE SCENARIO

Slide 74

Slide 74 text

What does this mean? Performance scales *at least* proportionally to memory settings

Slide 75

Slide 75 text

What does this mean? Higher memory settings result in higher levels of consistency

Slide 76

Slide 76 text

What does this mean? Benchmarking requires long term data capture to be sure of reliable interpretation

Slide 77

Slide 77 text

Digital Performance Platform Comparison

Slide 78

Slide 78 text

Response Time Under Load Azure Functions Google Cloud AWS Lambda http://cloudacademy.com/blog/microsoft-azure-functions-vs-google-cloud-functions-fight-for-serverless-cloud-domination-continues/

Slide 79

Slide 79 text

Digital Performance Questions

Slide 80

Slide 80 text

Andy Still : Technical Director & Founder, Intechnica Web: www.intechnica.co.uk Email: [email protected] Twitter: @andy_still / @intechnica Blog: http://www.internetperformanceexpert.com/ http://www.intechnica.co.uk/web-performance-warrior.aspx http://oreil.ly/2cJLxZh http://oreil.ly/2ce2ghE