Top Banner
Serverless Meetup, Los Angeles December 7, 2016 Lessons Learned: Creating an API w/ the Serverless Framework, AWS Lambda & API Gateway
21

LA Serverless Framework Meetup

Jan 18, 2017

Download

Technology

Marc Campbell
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: LA Serverless Framework Meetup

Serverless Meetup, Los AngelesDecember 7, 2016

Lessons Learned: Creating an API w/ the Serverless Framework, AWS Lambda & API Gateway

Page 2: LA Serverless Framework Meetup

Marc Campbell Joe Toscano

Page 3: LA Serverless Framework Meetup

Serverless

Page 4: LA Serverless Framework Meetup

AWS Lambda

Page 5: LA Serverless Framework Meetup

Initial Project

Page 6: LA Serverless Framework Meetup
Page 7: LA Serverless Framework Meetup

Why AWS Lambda?

Page 8: LA Serverless Framework Meetup

No Devops Tooling Unlimited* ScalingLower Cost

Page 9: LA Serverless Framework Meetup

But… Enterprise...

Page 10: LA Serverless Framework Meetup

Multiple Deployment Options

Page 11: LA Serverless Framework Meetup

Why Framework?

Page 12: LA Serverless Framework Meetup

Deployment Options

Now● AWS Lambda

Soon● Google Cloud Functions● IBM OpenWhisk● Azure Functions

Page 13: LA Serverless Framework Meetup

Lambda wasn’t without challenges

Page 14: LA Serverless Framework Meetup

Serverless Version

0.5 1.0 RC

Page 15: LA Serverless Framework Meetup

Lessons Learned!

● Make sure it’s the right project

● Monitor your lambdas

● Understand container reuse

Page 16: LA Serverless Framework Meetup

Quick tips● Offline local dev: serverless-offline

○ https://github.com/dherault/serverless-offline

● Logging: sls logs -t

● Avoid native modules

○ If you must: https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/

● Use NodeJS 4.3, it’s what Lambda uses!

Page 17: LA Serverless Framework Meetup

#1: Make sure it’s the right project

Good Candidates

Background workersEvent-Driven Tasks

Rely on Dynamic Scaling

Bad Candidates

Low Latency APIsNon-“spikey” workloads

Page 18: LA Serverless Framework Meetup

#2: Monitor your funcs

● Monitor every invocation● Metrics available: duration, # invocations, mem, cpu, errors,

cold starts● Log/metrics correlation● Detect leaks (memory, file descriptor)● Cold start reporting● Stack traces● Realtime dashboard, email reports● Coming soon: triggers/alerts, distributed tracing

Get early access at - iopipe.com

Page 19: LA Serverless Framework Meetup

#2: Monitor your funcs

Page 20: LA Serverless Framework Meetup

● Containers get reused and recycled● fd leaks, service handles (e.g. databases)● Filesystem usage (e.g. /tmp)● Cold starts after inactivity (~5m)● Cold starts after 4h no matter what!

#3: Understand container reuse

Page 21: LA Serverless Framework Meetup

Review

No DevopsMostly true. We wrote some chatops, but it was less than writing Ansible scripts.

Lower CostUsually true. Depends on the project.

Infinite ScalabilityTrue.

Multiple Deployment OptionsBecoming true.