Top Banner
from the TRENCHES TRENCHES what you should know before you go to production AWS LAMBDA AWS LAMBDA
221

AWS Lambda from the trenches (Serverless London)

Jan 23, 2018

Download

Technology

Yan Cui
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: AWS Lambda from the trenches (Serverless London)

from the

TRENCHESTRENCHES

what you should know before you go to production

AWS LAMBDAAWS LAMBDA

Page 2: AWS Lambda from the trenches (Serverless London)

hi, I’m Yan Cui

Page 3: AWS Lambda from the trenches (Serverless London)

hi, I’m Yan CuiAWS user since 2009

Page 4: AWS Lambda from the trenches (Serverless London)
Page 5: AWS Lambda from the trenches (Serverless London)
Page 6: AWS Lambda from the trenches (Serverless London)
Page 7: AWS Lambda from the trenches (Serverless London)
Page 8: AWS Lambda from the trenches (Serverless London)
Page 9: AWS Lambda from the trenches (Serverless London)
Page 10: AWS Lambda from the trenches (Serverless London)

apr, 2016

Page 11: AWS Lambda from the trenches (Serverless London)

hidden complexities and dependencies

low utilisation to leave room for traffic spikes

EC2 scaling is slow, so scale earlier

lots of cost for unused resources

up to 30 mins for deployment

deployment required downtime

Page 12: AWS Lambda from the trenches (Serverless London)

- Dan North

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

metric that matters.”

Page 13: AWS Lambda from the trenches (Serverless London)
Page 14: AWS Lambda from the trenches (Serverless London)

“what would good

look like for us?”

Page 15: AWS Lambda from the trenches (Serverless London)

be small be fast

have zero downtime have no lock-step

DEPLOYMENTS SHOULD...

Page 16: AWS Lambda from the trenches (Serverless London)

FEATURES SHOULD...be deployable independently

be loosely-coupled

Page 17: AWS Lambda from the trenches (Serverless London)

WE WANT TO...minimise cost for unused resources

minimise ops effort reduce tech mess

deliver visible improvements faster

Page 18: AWS Lambda from the trenches (Serverless London)

nov, 2016

Page 19: AWS Lambda from the trenches (Serverless London)

170 Lambda functions in prod

1.2 GB deployment packages in prod

95% cost saving vs EC2

15x no. of prod releases per month

Page 20: AWS Lambda from the trenches (Serverless London)

timeis a good fit

Page 21: AWS Lambda from the trenches (Serverless London)

1st function in prod!time

is a good fit

Page 22: AWS Lambda from the trenches (Serverless London)

?

timeis a good fit

1st function in prod!

Page 23: AWS Lambda from the trenches (Serverless London)

Practices ToolsPrinciples

what is good? how to make it good? with what?

Page 24: AWS Lambda from the trenches (Serverless London)

Principles outlast Tools

Page 25: AWS Lambda from the trenches (Serverless London)

ALERTING

CI / CD

TESTING

LOGGING

MONITORING

Page 26: AWS Lambda from the trenches (Serverless London)

170 functions

WOOF!

? ?

timeis a good fit

1st function in prod!

Page 27: AWS Lambda from the trenches (Serverless London)

SECURITY

DISTRIBUTEDTRACING

CONFIGMANAGEMENT

Page 28: AWS Lambda from the trenches (Serverless London)

evolving the PLATFORM

Page 29: AWS Lambda from the trenches (Serverless London)

rebuilt search

Page 30: AWS Lambda from the trenches (Serverless London)

Legacy Monolith Amazon Kinesis Amazon Lambda

Amazon CloudSearch

Page 31: AWS Lambda from the trenches (Serverless London)

Legacy Monolith Amazon Kinesis Amazon Lambda

Amazon CloudSearchAmazon API Gateway Amazon Lambda

Page 32: AWS Lambda from the trenches (Serverless London)

new analytics pipeline

Page 33: AWS Lambda from the trenches (Serverless London)

Legacy Monolith Amazon Kinesis Amazon Lambda

Google BigQuery

Page 34: AWS Lambda from the trenches (Serverless London)

Legacy Monolith Amazon Kinesis Amazon Lambda

Google BigQuery

1 developer, 2 daysdesign production

(his 1st serverless project)

Page 35: AWS Lambda from the trenches (Serverless London)

Legacy Monolith Amazon Kinesis Amazon Lambda

Google BigQuery“nothing ever got done

this fast at Skype!”

- Chris Twamley

Page 36: AWS Lambda from the trenches (Serverless London)

- Dan North

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

metric that matters.”

Page 37: AWS Lambda from the trenches (Serverless London)

Rebuiltwith Lambda

Page 38: AWS Lambda from the trenches (Serverless London)
Page 39: AWS Lambda from the trenches (Serverless London)
Page 40: AWS Lambda from the trenches (Serverless London)
Page 41: AWS Lambda from the trenches (Serverless London)
Page 42: AWS Lambda from the trenches (Serverless London)
Page 43: AWS Lambda from the trenches (Serverless London)
Page 44: AWS Lambda from the trenches (Serverless London)

Rebuiltwith Lambda

Page 45: AWS Lambda from the trenches (Serverless London)

BigQuery

Page 46: AWS Lambda from the trenches (Serverless London)

BigQuery

Page 47: AWS Lambda from the trenches (Serverless London)

grapheneDB

BigQuery

Page 48: AWS Lambda from the trenches (Serverless London)

grapheneDB

BigQuery

Page 49: AWS Lambda from the trenches (Serverless London)

grapheneDB

BigQuery

Page 50: AWS Lambda from the trenches (Serverless London)

getting PRODUCTION READY

Page 51: AWS Lambda from the trenches (Serverless London)

CHOOSE A

FRAMEWORK

DEPLOYMENT

Page 52: AWS Lambda from the trenches (Serverless London)

http://serverless.com

Page 53: AWS Lambda from the trenches (Serverless London)

https://github.com/awslabs/serverless-application-model

Page 54: AWS Lambda from the trenches (Serverless London)

http://apex.run

Page 55: AWS Lambda from the trenches (Serverless London)

https://apex.github.io/up

Page 56: AWS Lambda from the trenches (Serverless London)

https://github.com/claudiajs/claudia

Page 57: AWS Lambda from the trenches (Serverless London)

https://github.com/Miserlou/Zappa

Page 58: AWS Lambda from the trenches (Serverless London)

http://gosparta.io/

Page 59: AWS Lambda from the trenches (Serverless London)

TESTING

Page 60: AWS Lambda from the trenches (Serverless London)

amzn.to/29Lxuzu

Page 61: AWS Lambda from the trenches (Serverless London)

Level of Testing

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

Page 62: AWS Lambda from the trenches (Serverless London)
Page 63: AWS Lambda from the trenches (Serverless London)

Level of Testing

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

Page 64: AWS Lambda from the trenches (Serverless London)

handler

Page 65: AWS Lambda from the trenches (Serverless London)

handler

test by invoking the handler

Page 66: AWS Lambda from the trenches (Serverless London)

Level of Testing

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

Page 67: AWS Lambda from the trenches (Serverless London)

Level of Testing

unit

integration

acceptance

feedb

ack

confidence

Page 68: AWS Lambda from the trenches (Serverless London)

“…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 69: AWS Lambda from the trenches (Serverless London)

“…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 70: AWS Lambda from the trenches (Serverless London)

Don’t Mock Types You Can’t ChangeServices

Page 71: AWS Lambda from the trenches (Serverless London)

Paul Johnston

The serverless approach to testing is different and may

actually be easier.

http://bit.ly/2t5viwK

Page 72: AWS Lambda from the trenches (Serverless London)

LambdaAPI Gateway DynamoDB

Page 73: AWS Lambda from the trenches (Serverless London)

LambdaAPI Gateway DynamoDB

Unit Tests

Page 74: AWS Lambda from the trenches (Serverless London)

LambdaAPI Gateway DynamoDB

Unit Tests

Mock/Stub

Page 75: AWS Lambda from the trenches (Serverless London)

is our request correct?

is the request mapping set up correctly?is the API resources

configured correctly?

are we assuming the correct schema?

LambdaAPI Gateway DynamoDB

is Lambda proxy configured correctly?

is IAM policy set up correctly?

is the table created?

what unit tests will not tell you…

Page 76: AWS Lambda from the trenches (Serverless London)
Page 77: AWS Lambda from the trenches (Serverless London)

most Lambda functions are simple have single purpose, the risk of

shipping broken software has largely shifted to how they integrate with

external services

observation

Page 78: AWS Lambda from the trenches (Serverless London)
Page 79: AWS Lambda from the trenches (Serverless London)

But it slows down my feedback loop…

IT’S NOT ABOUT YOU!

Page 80: AWS Lambda from the trenches (Serverless London)
Page 81: AWS Lambda from the trenches (Serverless London)

IT’S CHINA. NOT SCHINA.

Page 82: AWS Lambda from the trenches (Serverless London)
Page 83: AWS Lambda from the trenches (Serverless London)
Page 84: AWS Lambda from the trenches (Serverless London)
Page 85: AWS Lambda from the trenches (Serverless London)
Page 86: AWS Lambda from the trenches (Serverless London)
Page 87: AWS Lambda from the trenches (Serverless London)
Page 88: AWS Lambda from the trenches (Serverless London)

me

Your users shouldn’t be the ones to pay the price for your

faster feedback loop. Optimise for working software.

Test your software end-to-end.

Page 89: AWS Lambda from the trenches (Serverless London)

“…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 90: AWS Lambda from the trenches (Serverless London)

Legacy Monolith Amazon Kinesis Amazon Lambda

Amazon CloudSearchAmazon API Gateway Amazon Lambda

Page 91: AWS Lambda from the trenches (Serverless London)

Legacy Monolith Amazon Kinesis Amazon Lambda

Amazon CloudSearchAmazon API Gateway Amazon Lambda

Test Input

Page 92: AWS Lambda from the trenches (Serverless London)

Legacy Monolith Amazon Kinesis Amazon Lambda

Amazon CloudSearchAmazon API Gateway Amazon Lambda

Test Input

Validate

Page 93: AWS Lambda from the trenches (Serverless London)

integration tests exercise system’s Integration with its

external dependencies

Page 94: AWS Lambda from the trenches (Serverless London)

acceptance tests exercise system End-to-End from

the outside

Page 95: AWS Lambda from the trenches (Serverless London)

integration tests differ from acceptance tests only in HOW the

Lambda functions are invoked

observation

Page 96: AWS Lambda from the trenches (Serverless London)
Page 97: AWS Lambda from the trenches (Serverless London)
Page 98: AWS Lambda from the trenches (Serverless London)
Page 99: AWS Lambda from the trenches (Serverless London)

CI + CD PIPELINE

Page 100: AWS Lambda from the trenches (Serverless London)

“the earlier you consider CI + CD, the more time you save in the long run”

- me

Page 101: AWS Lambda from the trenches (Serverless London)

“…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 102: AWS Lambda from the trenches (Serverless London)

“deployment scripts that only live on the CI

box is a disaster waiting to happen”

- me

Page 103: AWS Lambda from the trenches (Serverless London)

Jenkins build config deploys and tests

unit + integration tests

deploy

acceptance tests

Page 104: AWS Lambda from the trenches (Serverless London)

if [ "$1" = "deploy" ] && [ $# -eq 4 ]; then STAGE=$2 REGION=$3 PROFILE=$4

npm install AWS_PROFILE=$PROFILE 'node_modules/.bin/sls' deploy -s $STAGE -r $REGION elif [ "$1" = "int-test" ] && [ $# -eq 4 ]; then STAGE=$2 REGION=$3 PROFILE=$4

npm install AWS_PROFILE=$PROFILE npm run int-$STAGE elif [ "$1" = "acceptance-test" ] && [ $# -eq 4 ]; then STAGE=$2 REGION=$3 PROFILE=$4

npm install AWS_PROFILE=$PROFILE npm run acceptance-$STAGE else usage exit 1 fi

Page 105: AWS Lambda from the trenches (Serverless London)

build.sh allows repeatable builds on both local & CI

Page 106: AWS Lambda from the trenches (Serverless London)
Page 107: AWS Lambda from the trenches (Serverless London)

Auto Auto Manual

Page 108: AWS Lambda from the trenches (Serverless London)

LOGGING

Page 109: AWS Lambda from the trenches (Serverless London)
Page 110: AWS Lambda from the trenches (Serverless London)

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

Page 111: AWS Lambda from the trenches (Serverless London)

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 112: AWS Lambda from the trenches (Serverless London)

function name

date

function version

Page 113: AWS Lambda from the trenches (Serverless London)

LOG OVERLOAD

Page 114: AWS Lambda from the trenches (Serverless London)

CENTRALISE LOGS

Page 115: AWS Lambda from the trenches (Serverless London)

CENTRALISE LOGS

MAKE THEM EASILYSEARCHABLE

Page 116: AWS Lambda from the trenches (Serverless London)

+ +the elk stack

Page 117: AWS Lambda from the trenches (Serverless London)

CloudWatch Logs

Page 118: AWS Lambda from the trenches (Serverless London)

CloudWatch Logs AWS Lambda ELK stack

Page 119: AWS Lambda from the trenches (Serverless London)

CloudWatch Events

Page 120: AWS Lambda from the trenches (Serverless London)
Page 121: AWS Lambda from the trenches (Serverless London)

http://bit.ly/2f3zxQG

Page 122: AWS Lambda from the trenches (Serverless London)

DISTRIBUTED TRACING

Page 123: AWS Lambda from the trenches (Serverless London)
Page 124: AWS Lambda from the trenches (Serverless London)

“my followers didn’t receive my new post!”

- a user

Page 125: AWS Lambda from the trenches (Serverless London)

where could the problem be?

Page 126: AWS Lambda from the trenches (Serverless London)

correlation IDs*

* eg. request-id, user-id, yubl-id, etc.

Page 127: AWS Lambda from the trenches (Serverless London)

ROLL YOUR OWNCLIENTS

Page 128: AWS Lambda from the trenches (Serverless London)

kinesis client

http client

sns client

Page 129: AWS Lambda from the trenches (Serverless London)

http://bit.ly/2k93hAj

Page 130: AWS Lambda from the trenches (Serverless London)

ROLL YOUR OWNCLIENTS

X-RAY

Page 131: AWS Lambda from the trenches (Serverless London)

Amazon X-Ray

Page 132: AWS Lambda from the trenches (Serverless London)

Amazon X-Ray

Page 133: AWS Lambda from the trenches (Serverless London)

traces do not span over API Gateway

Page 134: AWS Lambda from the trenches (Serverless London)

http://bit.ly/2s9yxmA

Page 135: AWS Lambda from the trenches (Serverless London)

MONITORING + ALERTING

Page 136: AWS Lambda from the trenches (Serverless London)

“where do I install monitoring agents?”

Page 137: AWS Lambda from the trenches (Serverless London)

you can’t

Page 138: AWS Lambda from the trenches (Serverless London)

• invocation Count• error Count• latency• throttling• granular to the minute• support custom metrics

Page 139: AWS Lambda from the trenches (Serverless London)

• same metrics as CW• better dashboard• support custom metrics

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

Page 140: AWS Lambda from the trenches (Serverless London)
Page 141: AWS Lambda from the trenches (Serverless London)

“how do I batch up and send logs in the

background?”

Page 142: AWS Lambda from the trenches (Serverless London)

you can’t (kinda)

Page 143: AWS Lambda from the trenches (Serverless London)

console.log(“hydrating yubls from db…”);

console.log(“fetching user info from user-api”);

console.log(“MONITORING|1489795335|27.4|latency|user-api-latency”);

console.log(“MONITORING|1489795335|8|count|yubls-served”);

timestamp metric value

metric type

metric namemetrics

logs

Page 144: AWS Lambda from the trenches (Serverless London)

CloudWatch Logs AWS Lambda

ELK stacklogs

metrics

CloudWatch

Page 145: AWS Lambda from the trenches (Serverless London)

http://bit.ly/2gGredx

Page 146: AWS Lambda from the trenches (Serverless London)

DASHBOARDS

Page 147: AWS Lambda from the trenches (Serverless London)

DASHBOARDS

SET ALARMS

Page 148: AWS Lambda from the trenches (Serverless London)

DASHBOARDS

SET ALARMS

TRACK APP-LEVELMETRICS

Page 149: AWS Lambda from the trenches (Serverless London)

Not Only CloudWatch

Page 150: AWS Lambda from the trenches (Serverless London)
Page 151: AWS Lambda from the trenches (Serverless London)

“you really don't want your monitoring

system to fail at the same time as the

system it monitors” - me

Page 152: AWS Lambda from the trenches (Serverless London)

CONFIG MANAGEMENT

Page 153: AWS Lambda from the trenches (Serverless London)

easily and quickly propagate config changes

Page 154: AWS Lambda from the trenches (Serverless London)
Page 155: AWS Lambda from the trenches (Serverless London)

CENTRALISEDCONFIG SERVICE

Page 156: AWS Lambda from the trenches (Serverless London)

config servicegoes here

Page 157: AWS Lambda from the trenches (Serverless London)
Page 158: AWS Lambda from the trenches (Serverless London)
Page 159: AWS Lambda from the trenches (Serverless London)
Page 160: AWS Lambda from the trenches (Serverless London)

SSM Parameter

Store

Page 161: AWS Lambda from the trenches (Serverless London)

sensitive data should be encrypted in-flight, and at rest

(credentials, connection string, etc.)

Page 162: AWS Lambda from the trenches (Serverless London)

role-based access

Page 163: AWS Lambda from the trenches (Serverless London)

SSM Parameter Store

HTTPS

role-based access

encrypted in-flight

Page 164: AWS Lambda from the trenches (Serverless London)

SSM Parameter Store

encrypt

role-based access

Page 165: AWS Lambda from the trenches (Serverless London)

SSM Parameter Store

encrypted at-rest

Page 166: AWS Lambda from the trenches (Serverless London)

HTTPS

role-based access

SSM Parameter Store

encrypted in-flight

Page 167: AWS Lambda from the trenches (Serverless London)

CENTRALISEDCONFIG SERVICE

CLIENT LIBRARY

Page 168: AWS Lambda from the trenches (Serverless London)

fetch & cache at Cold Start

Page 169: AWS Lambda from the trenches (Serverless London)

invalidate at interval + signal

Page 170: AWS Lambda from the trenches (Serverless London)

http://bit.ly/2yLUjwd

Page 171: AWS Lambda from the trenches (Serverless London)

PRO TIPS

Page 172: AWS Lambda from the trenches (Serverless London)

max 75 GB total deployment package size*

* limit is per AWS region

Page 173: AWS Lambda from the trenches (Serverless London)

Janitor Monkey

Page 174: AWS Lambda from the trenches (Serverless London)

Janitor Lambda

http://bit.ly/2xzVu4a

Page 175: AWS Lambda from the trenches (Serverless London)

disable versionFunctions in

Page 176: AWS Lambda from the trenches (Serverless London)

install Serverless framework as dev dependency at project level

dev dependencies are excluded since 1.16.0

Page 177: AWS Lambda from the trenches (Serverless London)

http://bit.ly/2vzBqhC

Page 178: AWS Lambda from the trenches (Serverless London)

http://amzn.to/2vtUkDU

Page 179: AWS Lambda from the trenches (Serverless London)

UNDERSTANDCOLDSTARTS

Page 180: AWS Lambda from the trenches (Serverless London)

Amazon X-Ray1st invocation

2nd invocation

cold start

Page 181: AWS Lambda from the trenches (Serverless London)

source: http://bit.ly/2oBEbw2

Page 182: AWS Lambda from the trenches (Serverless London)

EMBRACENODE.JS & PYTHON

Page 183: AWS Lambda from the trenches (Serverless London)

http://bit.ly/2rtCCBz

Page 184: AWS Lambda from the trenches (Serverless London)

C#

http://bit.ly/2rtCCBz

Page 185: AWS Lambda from the trenches (Serverless London)

Java

http://bit.ly/2rtCCBz

Page 186: AWS Lambda from the trenches (Serverless London)

NodeJs, Python

http://bit.ly/2rtCCBz

Page 187: AWS Lambda from the trenches (Serverless London)

what about type safety?

Page 188: AWS Lambda from the trenches (Serverless London)
Page 189: AWS Lambda from the trenches (Serverless London)

complexity ceiling of a Node.js app

com

plex

ity

Page 190: AWS Lambda from the trenches (Serverless London)

complexity ceiling of a Node.js app

com

plex

ity

referential transparencyimmutability as default

type inferenceoption typesunion types

Page 191: AWS Lambda from the trenches (Serverless London)

for managing complexity

complexity ceiling of a Node.js app

com

plex

ity

referential transparencyimmutability as default

type inferenceoption typesunion types

Page 192: AWS Lambda from the trenches (Serverless London)

complexity ceiling of a Node.js app

com

plex

ity

complexity ceiling of a Node.js Lambda function

Page 193: AWS Lambda from the trenches (Serverless London)

if you can limit the complexity of your solution, maybe you

won’t need the tools for managing that complexity.me

Page 194: AWS Lambda from the trenches (Serverless London)

AVOID HARDASSUMPTIONS

ABOUT FUNCTIONLIFETIME

Page 195: AWS Lambda from the trenches (Serverless London)

USE STATE FOR

OPTIMISATION

Page 196: AWS Lambda from the trenches (Serverless London)

AVOIDCOLDSTARTS

Page 197: AWS Lambda from the trenches (Serverless London)

CloudWatch Event AWS Lambda

Page 198: AWS Lambda from the trenches (Serverless London)

CloudWatch Event AWS Lambda

ping

ping

ping

ping

Page 199: AWS Lambda from the trenches (Serverless London)

CloudWatch Event AWS Lambda

ping

ping

ping

ping

Page 200: AWS Lambda from the trenches (Serverless London)

CloudWatch Event AWS Lambda

ping

ping

ping

ping

HEALTH CHECKS?

Page 201: AWS Lambda from the trenches (Serverless London)

max 5 mins execution time

Page 202: AWS Lambda from the trenches (Serverless London)

USE RECURSIONFOR LONG

RUNNING TASKS

Page 203: AWS Lambda from the trenches (Serverless London)

CONSIDERPARTIAL

FAILURES

Page 204: AWS Lambda from the trenches (Serverless London)

“AWS Lambda polls your stream and invokes your Lambda function. Therefore, if

a Lambda function fails, AWS Lambda attempts to process the erring batch of

records until the time the data expires…”

http://docs.aws.amazon.com/lambda/latest/dg/retries-on-errors.html

Page 205: AWS Lambda from the trenches (Serverless London)

should function fail on partial/any failures?

Page 206: AWS Lambda from the trenches (Serverless London)

SNS

Kinesis

SQS

after 3 attempts

share processing logic

events are processed in chronological order

failed events are retried out of sequence

Page 207: AWS Lambda from the trenches (Serverless London)

PROCESS SQSWITH RECURSIVE

FUNCTIONS

Page 208: AWS Lambda from the trenches (Serverless London)

http://bit.ly/2npomX6

Page 209: AWS Lambda from the trenches (Serverless London)

AVOID HOTKINESS

STREAMS

Page 210: AWS Lambda from the trenches (Serverless London)

“Each shard can support up to 5 transactions per second for reads, up to a maximum total data

read rate of 2 MB per second.”

http://docs.aws.amazon.com/streams/latest/dev/service-sizes-and-limits.html

Page 211: AWS Lambda from the trenches (Serverless London)

“If your stream has 100 active shards, there will be 100 Lambda functions running concurrently. Then, each

Lambda function processes events on a shard in the order that they arrive.”

http://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html

Page 212: AWS Lambda from the trenches (Serverless London)

when no. of processors goes up…

Page 213: AWS Lambda from the trenches (Serverless London)

ReadProvisionedThroughputExceeded

can have too many Kinesis read operations…

Page 214: AWS Lambda from the trenches (Serverless London)

ReadRecords.IteratorAge

unpredictable spikes in read ‘latency’…

Page 215: AWS Lambda from the trenches (Serverless London)

can kinda workaround…

Page 216: AWS Lambda from the trenches (Serverless London)

http://bit.ly/2uv5LsH

Page 217: AWS Lambda from the trenches (Serverless London)

clever, but costly

Page 218: AWS Lambda from the trenches (Serverless London)

for subsystems that don’t have to be realtime, or are task-

based (ie. order doesn’t matter), consider other

triggers such as S3 or SNS.me

Page 219: AWS Lambda from the trenches (Serverless London)

@theburningmonktheburningmonk.comgithub.com/theburningmonk

Page 220: AWS Lambda from the trenches (Serverless London)

@theburningmonktheburningmonk.comgithub.com/theburningmonk

http://bit.ly/2yQZj1H

all my blog posts on Lambda

Page 221: AWS Lambda from the trenches (Serverless London)

sign up here: http://bit.ly/2xIO23O