The future of paas is serverless

156
+ = THE FUTURE OF PAAS IS SERVERLESS

Transcript of The future of paas is serverless

Page 1: The future of paas is serverless

+ =

THE FUTURE OF PAAS ISSERVERLESS

Page 2: The future of paas is serverless

hi, my name is Yan Cui@theburningmonk

Page 3: The future of paas is serverless
Page 4: The future of paas is serverless
Page 5: The future of paas is serverless

“as a Software Engineer, what is my job?”

Page 6: The future of paas is serverless

“to write code, of course!”- Me, circa 2006

Page 7: The future of paas is serverless

“to provide value to users & stakeholders”

- Me, 2016

Page 8: The future of paas is serverless
Page 9: The future of paas is serverless

- Dan North

“lead time to someone saying thank you is the only reputation

metric that matters.”

Page 10: The future of paas is serverless

THEBALANCE

COMPETING

FORCES

Page 11: The future of paas is serverless

performance

security

scalabilitysimplicity

cost

team

time to market

Page 12: The future of paas is serverless

“Programmers know the benefits of everything and the tradeoffs of nothing.”

- Rich Hickey

https://www.infoq.com/presentations/Simple-Made-Easy

Page 13: The future of paas is serverless

context is the king

Page 14: The future of paas is serverless
Page 15: The future of paas is serverless
Page 16: The future of paas is serverless

security

complexity OUTSIDE the code

deployment

load balancing

caching

monitoring

config management

https://www.infoq.com/presentations/complexity-simplicity-esb

centralised logging

elastic scalingsetup server

Page 17: The future of paas is serverless
Page 18: The future of paas is serverless
Page 19: The future of paas is serverless
Page 20: The future of paas is serverless
Page 21: The future of paas is serverless

Leaky Abstraction

Page 22: The future of paas is serverless

AWS re:invent 2014https://www.youtube.com/watch?v=9eHoyUVo-yg

Page 23: The future of paas is serverless

AWS re:invent 2014https://www.youtube.com/watch?v=9eHoyUVo-yg

FAAS(Function-As-A-Service)

Page 24: The future of paas is serverless
Page 25: The future of paas is serverless

THERE IS NO SERVER

Page 26: The future of paas is serverless

cost saving

Page 27: The future of paas is serverless

charged by invocations

Page 28: The future of paas is serverless

not paying for idle servers

Page 29: The future of paas is serverless
Page 30: The future of paas is serverless

elastic scaling

Page 31: The future of paas is serverless
Page 32: The future of paas is serverless

hi guys,come back at 10 to find

out who won!

Page 33: The future of paas is serverless

everyone came back at exactly 10pm!

Page 34: The future of paas is serverless

everyone came back at exactly 10pm!

Lambda scaled instantly

Page 35: The future of paas is serverless

minimiseundifferentiated

heavy-lifting

Page 36: The future of paas is serverless

“what about containers?”

Page 37: The future of paas is serverless
Page 38: The future of paas is serverless

important, butinvisible subsystems

Page 39: The future of paas is serverless

economy of scale

Page 40: The future of paas is serverless

NoOps!!

Page 41: The future of paas is serverless

reactive

Page 42: The future of paas is serverless
Page 43: The future of paas is serverless
Page 44: The future of paas is serverless
Page 45: The future of paas is serverless
Page 46: The future of paas is serverless
Page 47: The future of paas is serverless

simple, fast deployment

Page 48: The future of paas is serverless

first Lambda function went live

(team size : 4)

Page 49: The future of paas is serverless

(team size : 7)

155 prod deployments!

Page 50: The future of paas is serverless

- Dan North

“lead time to someone saying thank you is the only reputation

metric that matters.”

Page 51: The future of paas is serverless

easy to get started

Page 52: The future of paas is serverless
Page 53: The future of paas is serverless

now, we stand at 170 Lambda functions in prod, with 200+ in dev

Page 54: The future of paas is serverless

fuelling the Yubl platform evolution

Page 55: The future of paas is serverless

My Beautiful Monolith

Page 56: The future of paas is serverless

“What would a good

architecture for us look like?”

Page 57: The future of paas is serverless

small, incremental deployments

fast deployments

no downtime

no lock-step deployments

features deployed independently

features loosely-coupled through messages

minimise cost for unused resources

minimise ops effort

Page 58: The future of paas is serverless

oh, and do all these whilst continue

to deliver value, thanks :-)

love, your users

Page 59: The future of paas is serverless

completely rebuilt search

Page 60: The future of paas is serverless

Legacy Monolith Amazon Kinesis Amazon Lambda

Amazon CloudSearch

Page 61: The future of paas is serverless

Legacy Monolith Amazon Kinesis Amazon Lambda

Amazon CloudSearchAmazon API Gateway Amazon Lambda

Page 62: The future of paas is serverless

analytics pipeline

Page 63: The future of paas is serverless

Legacy Monolith Amazon Kinesis Amazon Lambda

Google BigQuery

Page 64: The future of paas is serverless

Legacy Monolith Amazon Kinesis Amazon Lambda

Google BigQuery

1 developer, 2 daysdesign production

(his 1st serverless project)

Page 65: The future of paas is serverless

Legacy Monolith Amazon Kinesis Amazon Lambda

Google BigQuery“nothing ever got done

this fast at Skype!”

- Chris Twamley

Page 66: The future of paas is serverless

- Dan North

“lead time to someone saying thank you is the only reputation

metric that matters.”

Page 67: The future of paas is serverless

Rebuiltwith Lambda

Page 68: The future of paas is serverless
Page 69: The future of paas is serverless
Page 70: The future of paas is serverless
Page 71: The future of paas is serverless
Page 72: The future of paas is serverless
Page 73: The future of paas is serverless
Page 74: The future of paas is serverless

Rebuiltwith Lambda

Page 75: The future of paas is serverless
Page 76: The future of paas is serverless
Page 77: The future of paas is serverless
Page 78: The future of paas is serverless
Page 79: The future of paas is serverless
Page 80: The future of paas is serverless

and many more…

Page 81: The future of paas is serverless

“JavaScript doesn’t scale well with complexity”

- People on the Internet

Page 82: The future of paas is serverless

but

Page 83: The future of paas is serverless

“limit complexity, and JavaScript isn’t so bad”

- Me

Page 84: The future of paas is serverless

USE ADEPLOYMENT FRAMEWORK

Page 85: The future of paas is serverless

http://serverless.com

Page 86: The future of paas is serverless

https://github.com/claudiajs/claudia

Page 87: The future of paas is serverless

https://github.com/Miserlou/Zappa

Page 88: The future of paas is serverless

http://gosparta.io/

Page 89: The future of paas is serverless

http://bit.ly/2e7aNDv

Page 90: The future of paas is serverless

TESTING

Page 91: The future of paas is serverless
Page 92: The future of paas is serverless

amzn.to/29Lxuzu

Page 93: The future of paas is serverless

Level of Testing

1.Unitdo our objects do the right thing?are they easy to work with?

Page 94: The future of paas is serverless
Page 95: The future of paas is serverless

Level of Testing

1.Unit2.Integrationdoes our code work against code we can’t change?

Page 96: The future of paas is serverless

handler

Page 97: The future of paas is serverless

handler

test by invoking the handler

Page 98: The future of paas is serverless

Level of Testing

1.Unit2.Integration3.Acceptancedoes the whole system work?

Page 99: The future of paas is serverless

Level of Testing

unit

integration

acceptance

Page 100: The future of paas is serverless

Level of Testing

unit

integration

acceptance

can do all 3 with Lambda

Page 101: The future of paas is serverless

“…We find that tests that mock external libraries often need to be complex to get the code into the right state for the functionality we need to exercise.

The mess in such tests is telling us that the design isn’t right but, instead of fixing the problem by improving the code, we have to carry the extra complexity in both code and test…”

Don’t Mock Types You Can’t Change

Page 102: The future of paas is serverless

“…The second risk is that we have to be sure that the behaviour we stub or mock matches what the external library will actually do…

Even if we get it right once, we have to make sure that the tests remain valid when we upgrade the libraries…”

Don’t Mock Types You Can’t Change

Page 103: The future of paas is serverless

Don’t Mock Types You Can’t ChangeServices

Page 104: The future of paas is serverless

“…Wherever possible, an acceptance test should exercise the system end-to-end without directly calling its internal code.

An end-to-end test interacts with the system only from the outside: through its interface…”

Testing End-to-End

Page 105: The future of paas is serverless

Legacy Monolith Amazon Kinesis Amazon Lambda

Amazon CloudSearchAmazon API Gateway Amazon Lambda

Page 106: The future of paas is serverless

Legacy Monolith Amazon Kinesis Amazon Lambda

Amazon CloudSearchAmazon API Gateway Amazon Lambda

Test Input

Page 107: The future of paas is serverless

Legacy Monolith Amazon Kinesis Amazon Lambda

Amazon CloudSearchAmazon API Gateway Amazon Lambda

Test Input

Validate

Page 108: The future of paas is serverless

“…We prefer to have the end-to-end tests exercise both the system and the process by which it’s built and deployed…

This sounds like a lot of effort (it is), but has to be done anyway repeatedly during the software’s lifetime…”

Testing End-to-End

Page 109: The future of paas is serverless

Jenkins build config deploys and tests

unit + integration tests

deploy

acceptance tests

Page 110: The future of paas is serverless

build.sh allows repeatable builds on both local & CI

Page 111: The future of paas is serverless

LOGGING

Page 112: The future of paas is serverless
Page 113: The future of paas is serverless

2016-07-12T12:24:37.571Z 994f18f9-482b-11e6-8668-53e4eab441ae GOT is off air, what do I do now?

Page 114: The future of paas is serverless

2016-07-12T12:24:37.571Z 994f18f9-482b-11e6-8668-53e4eab441ae GOT is off air, what do I do now?

UTC Timestamp API Gateway Request Id

your log message

Page 115: The future of paas is serverless

organised by Function + Version

Page 116: The future of paas is serverless

LOG OVERLOAD

Page 117: The future of paas is serverless

centralise your logs

Page 118: The future of paas is serverless

CloudWatch Logs AWS Lambda

LogStash ElasticSearch

Page 119: The future of paas is serverless

CloudWatch Logs AWS Lambda

LogStash ElasticSearch

AWS Elasticsearch

Page 120: The future of paas is serverless

CloudWatch Logs AWS Lambda

LogStash ElasticSearch

AWS Elasticsearch

Elastic Cloud

Page 121: The future of paas is serverless

CloudWatch Logs AWS Lambda

LogStash ElasticSearch

AWS Elasticsearch

Elastic Cloud

?

Page 122: The future of paas is serverless

correlation IDs

Page 123: The future of paas is serverless

MONITORING

Page 124: The future of paas is serverless

nowhere to install monitoring agents

Page 125: The future of paas is serverless

no time for background tasks

Page 126: The future of paas is serverless

• Invocation Count• Error Count• Latency (avg, min, max, sum)• Throttling• Granular to the minute• Support custom metrics

Page 127: The future of paas is serverless

• Same basic metrics• Better dashboard• Support custom metrics

https://www.datadoghq.com/blog/monitoring-lambda-functions-datadog/

Page 128: The future of paas is serverless
Page 129: The future of paas is serverless

Do It Yourself

Page 130: The future of paas is serverless

PRO TIPset up dashboards

Page 131: The future of paas is serverless

PRO TIPdon’t forget to set

up alarms

Page 132: The future of paas is serverless

PRO TIPadd application-level

metrics

Page 133: The future of paas is serverless

KEEP WARM

Page 134: The future of paas is serverless

functions are unloaded if idle for a while

Page 135: The future of paas is serverless

noticeable cold start time(package size matters)

Page 136: The future of paas is serverless

CloudWatch Event AWS Lambda

Page 137: The future of paas is serverless

CloudWatch Event AWS Lambda

ping

ping

ping

ping

Page 138: The future of paas is serverless

CloudWatch Event AWS Lambda

ping

ping

ping

ping

Page 139: The future of paas is serverless

CloudWatch Event AWS Lambda

ping

ping

ping

ping

HEALTH CHECKS?

Page 140: The future of paas is serverless

KNOW YOUR LIMITS

Page 141: The future of paas is serverless

max 50 MB deployment package size

Page 142: The future of paas is serverless

max 50 MB deployment package sizemax 75 GB total deployment package size*

* limit is per AWS region

Page 143: The future of paas is serverless

Janitor Monkey

Page 144: The future of paas is serverless

Janitor Lambda

Page 145: The future of paas is serverless

max 5 mins execution time

Page 146: The future of paas is serverless
Page 147: The future of paas is serverless

max 6 MB request payload size*

max 6 MB response payload size

* for a request-response event type

Page 148: The future of paas is serverless

default max 100 concurrent executions*

* soft-limit, can be raised via support ticket

Page 149: The future of paas is serverless

CAPEXOPEX

Page 150: The future of paas is serverless

fail fast fail cheaply

Page 151: The future of paas is serverless
Page 152: The future of paas is serverless

IBM OpenWhisk

Amazon Lambda Azure Web Functions

Google Cloud Functions

competition

faster innovation lower prices

Page 153: The future of paas is serverless
Page 154: The future of paas is serverless
Page 155: The future of paas is serverless

@theburningmonk

@theburningmonktheburningmonk.comgithub.com/theburningmonk

Page 156: The future of paas is serverless

@theburningmonk

@theburningmonktheburningmonk.comgithub.com/theburningmonk

slides at http://bit.ly/2ecqEql