the good, bad and ugly of serverless

38
Serverless The Good, the Bad and the Ugly Martin Raag [email protected] om

Upload: pipedrive

Post on 16-Apr-2017

150 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: The Good, Bad and Ugly of Serverless

ServerlessThe Good, the Bad and the Ugly

Martin [email protected]

Page 2: The Good, Bad and Ugly of Serverless

Functions as a Service

Page 3: The Good, Bad and Ugly of Serverless

Lambda

DynamoDB S3 Kinesis

Lambda

CloudFormation SWF CloudTrail SES Cognito API Gateway CloudWatchSNS

Page 4: The Good, Bad and Ugly of Serverless
Page 5: The Good, Bad and Ugly of Serverless

w

Page 6: The Good, Bad and Ugly of Serverless
Page 7: The Good, Bad and Ugly of Serverless
Page 8: The Good, Bad and Ugly of Serverless
Page 9: The Good, Bad and Ugly of Serverless

The serverless manifesto

• No machines, VMs, or containers visible in the programming model.

• Functions are the unit of deployment & scaling.

• Implicitly fault tolerant, as functions can run anywhere.

• Scales per request.

• Users can not over- or under-provision capacity.

• Permanent storage lives elsewhere.

• Never pay for idle, no cold servers or their costs.

• Bring your own code (BYOC).

• Metrics and logging are a universal right.

Page 10: The Good, Bad and Ugly of Serverless
Page 11: The Good, Bad and Ugly of Serverless

Latency

Page 12: The Good, Bad and Ugly of Serverless

Latency

• Coldstarts add ~100ms latency• Up to ~10s for JVM based functions• Keep your functions warm

Page 13: The Good, Bad and Ugly of Serverless

Latency

functions: hello: handler: handler.hello events: - http: path: hello method: get - schedule: rate(10 minutes)

Page 14: The Good, Bad and Ugly of Serverless

Latency

https://www.iopipe.com/2016/09/understanding-aws-lambda-coldstarts/

Page 15: The Good, Bad and Ugly of Serverless

Latency

0

0.0375

0.075

0.1125

0.15

0.1875

APIGW/Lambda ELB/EC2

time_

tola

l

Page 16: The Good, Bad and Ugly of Serverless

Latency (Cross Region)

0

0.325

0.65

0.975

1.3

APIGW/Lambda ELB/EC2

time_

tota

l

Page 17: The Good, Bad and Ugly of Serverless

Latency (Cross Region)

0

0.05

0.1

0.15

0.2

APIGW/Lambda ELB/EC2

time_

conn

ect

Page 18: The Good, Bad and Ugly of Serverless

API Gateway

Page 19: The Good, Bad and Ugly of Serverless

– Top Gear

“Ambitious, but rubbish.”

Page 20: The Good, Bad and Ugly of Serverless

What API Gateway does?• Authentication• Caching• Input validation• Request and response mapping• Throttling• Stages• Environment variables• SDK generation

Page 21: The Good, Bad and Ugly of Serverless

What API Gateway doesn’t?

• Integrate (well) with other AWS services

Page 22: The Good, Bad and Ugly of Serverless

API Gateway

• No CloudFront edge cache• Lambda timeout at 10s (maybe 30s)• No Certificate Manager integration

Page 23: The Good, Bad and Ugly of Serverless

https://forums.aws.amazon.com/thread.jspa?messageID=700646&#700646

Page 24: The Good, Bad and Ugly of Serverless

https://forums.aws.amazon.com/thread.jspa?messageID=700646&#700646

Page 25: The Good, Bad and Ugly of Serverless

https://forums.aws.amazon.com/thread.jspa?messageID=700646&#700646

Page 26: The Good, Bad and Ugly of Serverless

Configuration

Page 27: The Good, Bad and Ugly of Serverless

Configuration

https://12factor.net/build-release-run

Page 28: The Good, Bad and Ugly of Serverless

– Adam Wiggins (12 Factor App)

“The twelve-factor app stores config in environment variables.”

Page 29: The Good, Bad and Ugly of Serverless

https://www.concurrencylabs.com/blog/configure-your-lambda-function-like-a-champ-sail-smoothly/

Page 30: The Good, Bad and Ugly of Serverless

Local Environments

Page 31: The Good, Bad and Ugly of Serverless

Debugging

Page 32: The Good, Bad and Ugly of Serverless

Concurrent Execution Limit

Page 33: The Good, Bad and Ugly of Serverless

DoS yourself

Page 34: The Good, Bad and Ugly of Serverless
Page 35: The Good, Bad and Ugly of Serverless

That’s not all

• No persistent state• 5 minute execution limit• No atomic deployments of a service• Immature tooling• Vendor control / lock-in• Service Discovery

Page 36: The Good, Bad and Ugly of Serverless

Conclusion

Page 37: The Good, Bad and Ugly of Serverless

Further reading

http://martinfowler.com/articles/serverless.html

https://www.iopipe.com/2016/09/understanding-aws-lambda-coldstarts/

https://www.concurrencylabs.com/blog/configure-your-lambda-function-like-a-champ-sail-smoothly/

https://github.com/serverless/serverless

https://charity.wtf/2016/05/31/operational-best-practices-serverless/

Page 38: The Good, Bad and Ugly of Serverless

Release Your App With Confidence

Martin [email protected]