Contact v.kazulkin@iplabs.de Vadym Kazulkin ip.labs GmbH - - PowerPoint PPT Presentation

contact
SMART_READER_LITE
LIVE PREVIEW

Contact v.kazulkin@iplabs.de Vadym Kazulkin ip.labs GmbH - - PowerPoint PPT Presentation

Contact v.kazulkin@iplabs.de Vadym Kazulkin ip.labs GmbH xing.com/profile/Vadym_Kazulkin @VKazulkin @ServerlessBonn (Meetup) Christian Bannes c.bannes@iplabs.de ip.labs GmbH xing.com/profile/Christian_Bannes Ip.labs GmbH To FaaS...


slide-1
SLIDE 1
slide-2
SLIDE 2

Contact

Vadym Kazulkin

ip.labs GmbH

v.kazulkin@iplabs.de xing.com/profile/Vadym_Kazulkin @VKazulkin @ServerlessBonn (Meetup)

Christian Bannes

ip.labs GmbH

c.bannes@iplabs.de xing.com/profile/Christian_Bannes

slide-3
SLIDE 3

Ip.labs GmbH

slide-4
SLIDE 4

To FaaS... …or not to FaaS

slide-5
SLIDE 5

Image: https://aws.amazon.com/de/lambda/features

Function as a Service = AWS Lambda

slide-6
SLIDE 6

Image: https://aws.amazon.com/de/lambda/features

Serverless is more than Function as a Service

slide-7
SLIDE 7

Image: https://www.infoq.com/articles/serverless-sea-change/

Typical Three-Tier

slide-8
SLIDE 8

Image: https://www.infoq.com/articles/serverless-sea-change/

Function as a Service

slide-9
SLIDE 9

Image: https://www.infoq.com/articles/serverless-sea-change/

Serverless Applications

slide-10
SLIDE 10

Infrastructure cost

Image: https://stocksnap.io

slide-11
SLIDE 11

Velocity of your team

Image: https://burst.shopify.com

slide-12
SLIDE 12

What you really have to consider

Total Cost of Ownership

slide-13
SLIDE 13

Lambda pricing model

slide-14
SLIDE 14

Cost for lambda

REQUEST DURATION

slide-15
SLIDE 15

Request Tier

$ 0.20

Per 1 Mio Requests

slide-16
SLIDE 16

Duration Tier

$ 0.00001667

Per GB-Second

slide-17
SLIDE 17

GB-Second

ONE SECOND ONE GB

slide-18
SLIDE 18

Example

  • 1 Mio requests
  • Lambda with 512MiB
  • Each lambda takes 200ms

0.5 GiB * 0.2 sec * 1 Mio = 100 000 GB-Seconds

Requests:

$0.20

GB-Seconds:

$1.67

slide-19
SLIDE 19

Cost scales linearly with memory

slide-20
SLIDE 20

How does this compare to VM pricing model?

slide-21
SLIDE 21

Lambda performance compares to

  • M4 (general purpose)
  • M5 (general purpose)

EC2 Instance Families

slide-22
SLIDE 22

M5 General Purpose Instance

Cost scales linearly with memory

slide-23
SLIDE 23

Lamdba vs VM

https://www.youtube.com/watch?v=b1ebYEfQX1s

slide-24
SLIDE 24

Lambda compute is 5x more expensive than M5

slide-25
SLIDE 25

Threading Model

Idle Idle

Pay per wall clock time Pay per use

slide-26
SLIDE 26

Image: https://aws.amazon.com

AWS monetizes the datacenter… … by selling time on their servers

slide-27
SLIDE 27

Common pitfalls when working with lambda

slide-28
SLIDE 28

More memory = more expensive?

slide-29
SLIDE 29

Power tuning lambda

  • Executes different

settings in parallel

  • Outputs the optimal

setting

Image: https://github.com/alexcasalboni/aws-lambda-power-tuning

slide-30
SLIDE 30

Paying for wait time

Image: https://blog.binaris.com/lambda-pricing-pitfalls/

slide-31
SLIDE 31

The reality is…

Lambda is often just a small percentage

  • f your total cost
slide-32
SLIDE 32

$ 3.50

Per million API calls Api Gateway

slide-33
SLIDE 33

Event Sources

  • SQS and SNS are

charged for requests

  • Kinesis charges for

shard hours & PUT requests

Image: https://blog.binaris.com/lambda-pricing-pitfalls/

slide-34
SLIDE 34

Event Sources

  • Cost for Kinesis grows

with slower rate

  • Attractive at to
  • perate at scale

Image: https://blog.binaris.com/lambda-pricing-pitfalls/

slide-35
SLIDE 35

DynamoDB On-Demand

Image: https://aws.amazon.com/blogs/aws/amazon-dynamodb-on-demand-no-capacity-planning-and-pay-per-request-pricing/

slide-36
SLIDE 36

Provisioned vs On-Demand

  • Use On-Demand for

spiky workloads

  • Use Provisioned for

constantly high workload

slide-37
SLIDE 37

Cost saving with On-Demand

Image: https://twitter.com

Switch to "On-Demand"

slide-38
SLIDE 38

Example

$2400 / Month $520 / Month 100 API requests per second 24/7

  • API Gateway
  • Lambda with 1GB and

300ms per request

  • Load balancer
  • 3 x M5.xlarge with

16GB each

slide-39
SLIDE 39

Serverless vs VM

  • "Pay as you go" can significantly reduce server cost

because you don’t pay for ide time

  • For serverless you need right architecture
  • Consider the Total Cost of Ownership
slide-40
SLIDE 40

What you really have to consider:

Total Cost of Ownership

slide-41
SLIDE 41

Ajay Nair (https://twitter.com/ajaynairthinks/status/1057696133076541441)

slide-42
SLIDE 42

TCO Full Picture

Forrest Brazeal „The Business Case For Serverless” https://www.trek10.com/blog/business-case-for-serverless/

No Infrastructure Maintanence Auto Scaling Built in Fewer Engineers Required Lower Technical Debt Focus on Business Value & Innovation Faster Time to Market

slide-43
SLIDE 43

Do more with (Server-)less

slide-44
SLIDE 44

FaaS... …or not to FaaS ?

slide-45
SLIDE 45

Image: https://stock.adobe.com

slide-46
SLIDE 46
  • 1. Application lifecycle
  • 2. Workloads
  • 3. Platform limitations
  • 4. Cost at scale
  • 5. Operational constraints
  • 6. Organizational knowledge

Decision Checklist

slide-47
SLIDE 47

Understand Application lifecycle

Christian Posta „Be as serverless as you can, but not more than that” https://blog.christianposta.com/serverless/its-not-about-microservices-vs-serverless/

slide-48
SLIDE 48

Explore phase

  • Quickly validate

hypotheses

  • Rapidly experiment
  • Run experiments as

cheaply as possible

Image: burst.shopify.com/photos/a-look-across-the-landscape-with-view-of-the-sea

Serverless is a perfect fit

slide-49
SLIDE 49

Exploit phase

  • Built something that does

provide customer value

  • Build it on scale
  • Build a profitable product

around it

Image: Robert Scoble via Flickr

partly serverless and partly not serverless architecture

slide-50
SLIDE 50

Application lifecycle

  • How much of my stack should I own

to be able to deliver business value?

  • Outsource SLA, regulatory

compliance, price, and roadmap to my service provider?

slide-51
SLIDE 51

Existing applications

  • You can’t magically move

that all off to service providers

  • You can try to modernize

parts of them

slide-52
SLIDE 52

Strangler Pattern

  • Add a proxy (API

Gateway or Application Loadbalancer), which sits between the legacy application and the user

  • Add new services and

link it to the proxy

Marin Fowler „StrangerFigApplication” https://martinfowler.com/bliki/StranglerFigApplication.html

slide-53
SLIDE 53

FinDev Concept

Activity-based costing on a digital operation-by-operation basis

  • Figure out features which deliver

business value comparing to their cost

Aleksander Simovic & Mark Schwarz „FinDev and Serverless Microeconomics: Part 1” https://aws.amazon.com/de/blogs/enterprise-strategy/findev-and-serverless-microeconomics-part-1/

slide-54
SLIDE 54
  • 1. Application lifecycle
  • 2. Workloads
  • 3. Platform limitations
  • 4. Cost at scale
  • 5. Operational constraints imposed by other dependencies
  • 6. Organizational knowledge
slide-55
SLIDE 55

Understand your workloads

  • Event-driven
  • API-driven
  • Batch Job
  • ML/AI
  • Big Data

Image: flickr.com/photos/everywhereatonce/294789504

slide-56
SLIDE 56

Lambda Layers & Lambda Runtime API

Door opener for use case like:

  • Big Data
  • ML/AI
slide-57
SLIDE 57

Understand your workloads

  • Do we need to access specialized

hardware ?

  • GPU access required?
  • Another RAM/CPU ratio?
  • Do we need constantly high

performance?

  • Response time below 100 ms

(e.g. bidding or gaming platforms)

“A Berkeley View on Serverless Computing” https://www2.eecs.berkeley.edu/Pubs/TechRpts/2019/EECS-2019-3.html

slide-58
SLIDE 58

Understand your workloads

  • Do we need high throughput ?
  • Lambda‘s network bandwidth is limited

(an order of magnitude lower than a single modern SSD) shared between all functions packed on the same VM

“A Berkeley View on Serverless Computing” https://www2.eecs.berkeley.edu/Pubs/TechRpts/2019/EECS-2019-3.html

slide-59
SLIDE 59

Storage TradeOffs

“A Berkeley View on Serverless Computing” https://www2.eecs.berkeley.edu/Pubs/TechRpts/2019/EECS-2019-3.html

Latency Scaling Pricing Consistency

slide-60
SLIDE 60

S3 Storage TradeOffs

“A Berkeley View on Serverless Computing” https://www2.eecs.berkeley.edu/Pubs/TechRpts/2019/EECS-2019-3.html

Latency Scaling Pricing Consistency

slide-61
SLIDE 61

The State of Serverless Computing

“Chenggang Wu & Vikram Sreekanti - The State of Serverless Computing” Craft Conference 2019 - Budapest , Hungary https://www.youtube.com/watch?v=htLQiSPMUmk&list=LLYgjRSI2oCzI9eooyFrWR7A&index=6

slide-62
SLIDE 62

Understand your workloads

  • Do functions need to communicate with

each other?

  • functions are not directly network

accessible, they must communicate via an intermediary service

“A Berkeley View on Serverless Computing” https://www2.eecs.berkeley.edu/Pubs/TechRpts/2019/EECS-2019-3.html

slide-63
SLIDE 63
  • 1. Application lifecycle
  • 2. Workloads
  • 3. Platform limitations
  • 4. Cost at scale
  • 5. Operational constraints imposed by other dependencies
  • 6. Organizational knowledge
slide-64
SLIDE 64

Understand platform limitations

  • Cold start
  • Lambda with and without VPC for

each runtime

slide-65
SLIDE 65

Ajay Nair „Become a Serverless Black Belt” https://www.youtube.com/watch?v=oQFORsso2go

slide-66
SLIDE 66

Ajay Nair „Become a Serverless Black Belt” https://www.youtube.com/watch?v=oQFORsso2go

slide-67
SLIDE 67

Lambda in VPC

Chris Munns "Announcing improved VPC networking for AWS Lambda functions" https://aws.amazon.com/de/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/

slide-68
SLIDE 68

Lambda in VPC

As function’s execution environment scales

  • More network interfaces are created and

attached to the Lambda infrastructure.

  • The exact number of network interfaces

created and attached is a factor of your function configuration and concurrency.

Chris Munns: "Announcing improved VPC networking for AWS Lambda functions” https://aws.amazon.com/de/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/

slide-69
SLIDE 69

Lambda in VPC

As your function scales, be mindful of several issues:

  • Managing the IP address space in your

subnets

  • Reaching the account level network

interface limit

  • The potential to hit the API rate limit on

creating new network interfaces

Chris Munns: "Announcing improved VPC networking for AWS Lambda functions” https://aws.amazon.com/de/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/

slide-70
SLIDE 70

NEW: Lambda in VPC:

Leveraging AWS Hyperplane to provide NAT capabilities from the Lambda VPC to customer VPCs

Chris Munns: "Announcing improved VPC networking for AWS Lambda functions” https://aws.amazon.com/de/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/

slide-71
SLIDE 71

NEW: Lambda in VPC:

  • The network interface creation happens

when Lambda function is created or its VPC settings are updated.

  • Because the network interfaces are shared

across execution environments, only a handful of network interfaces are required per function

  • Function scaling is no longer directly tied to

the number of network interfaces

  • Hyperplane ENIs can scale to support

large numbers of concurrent function executions

Chris Munns: "Announcing improved VPC networking for AWS Lambda functions” https://aws.amazon.com/de/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/

slide-72
SLIDE 72

Amazon Aurora Serverless Data API as beta for MySql available

https://docs.aws.amazon.com/de_de/AmazonRDS/latest/AuroraUserGuide/data-api.html

slide-73
SLIDE 73

Don‘t be scared

  • f cold starts

To avoid cold starts them completely, you have to :

  • Overpay
  • Overprovision

Cold starts don’t really matter if the you make the call asynchronously

slide-74
SLIDE 74

Understand platform limitations

  • Cold start
  • Lambda with and without VPC for

each runtime

  • Invocation duration/timeouts
  • Lambda 15min
  • API Gateway integration 29sec
  • Max Memory
  • Lambda 3GB
slide-75
SLIDE 75

Understand platform limitations

  • Max concurrent invocations
  • 1000-3000 parallel executions for

all Lambdas in each AWS account

  • Scaling thresholds
  • Dynamo DB provisioned and on-

demand capacities

slide-76
SLIDE 76
  • 1. Application lifecycle
  • 2. Workloads
  • 3. Platform limitations
  • 4. Cost at scale
  • 5. Operational constraints imposed by other dependencies
  • 6. Organizational knowledge
slide-77
SLIDE 77

Understand your cost at scale

  • Lambda
  • API Gateway
  • Dynamo DB capacity choices
  • Remote API calls
  • Logging costs
  • Monitoring costs
slide-78
SLIDE 78
  • 1. Application lifecycle
  • 2. Workloads
  • 3. Platform limitations
  • 4. Cost at scale
  • 5. Operational constraints
  • 6. Organizational knowledge
slide-79
SLIDE 79

Understand the operational constraints (imposed by other dependencies)

  • Language runtime choice
  • Can be forced by some dependencies to
  • ther libraries

Yan Cui „Not so FaaS” https://blog.binaris.com/not-so-faas/

slide-80
SLIDE 80
  • 1. Application lifecycle
  • 2. Workloads
  • 3. Platform limitations
  • 4. Cost at scale
  • 5. Operational constraints imposed by other dependencies
  • 6. Organizational knowledge
slide-81
SLIDE 81

Understand organizational knowledge

  • Do you already have

DevOps knowledge?

slide-82
SLIDE 82

Tom McLaughlin Talk: What do we do when the server goes away?

  • Monitoring & Alerting
  • Chaos Engineering & Game Days
  • Infrastructure as Code & Testing
  • Help understand constraints
  • f AWS services & choose the right
  • ne

Tom McLaughlin „What do we do when the server goes away” https://speakerdeck.com/tmclaugh/serverless-devops-what-do-we-do-when-the-server-goes-away

slide-83
SLIDE 83

Understand organizational knowledge

  • Do you already have

DevOps knowledge?

  • Are the developers willing to

learn new languages?

slide-84
SLIDE 84

Future of Serverless

slide-85
SLIDE 85

Berkeley View on Serverless Computing

“A Berkeley View on Serverless Computing” https://www2.eecs.berkeley.edu/Pubs/TechRpts/2019/EECS-2019-3.html

slide-86
SLIDE 86

Berkeley View on Serverless Computing

  • Provide low latency and high IOPS

Serverless Ephemeral Storage

  • Provide Serverless Durable Storage
  • Improve Networking and Performance
  • Improve Security
  • Accommodate cost-performance

“A Berkeley View on Serverless Computing” https://www2.eecs.berkeley.edu/Pubs/TechRpts/2019/EECS-2019-3.html

slide-87
SLIDE 87
  • Application lifecycle
  • Workloads
  • Platform limitations
  • Cost at scale
  • Operational constraints
  • Organizational knowledge

FaaS or not to FaaS

slide-88
SLIDE 88
slide-89
SLIDE 89

Thank You!