Top Banner
Rotem Tamir Software Development Team Leader AtomData Running Serverless Microservices In the Wild
16

Serverless microservices in the wild

Apr 12, 2017

Download

Software

Rotem Tamir
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: Serverless microservices in the wild

Rotem TamirSoftware Development Team Leader

AtomData

Running Serverless Microservices

In the Wild

Page 2: Serverless microservices in the wild

About Me

● Team Leader @ AtomData, a Data Flow

Management platform by ironSource

● Full-stack Developer

● @_rtam on Twitter

● @rotemtam on Medium

Page 3: Serverless microservices in the wild

Before we begin

● Who is using serverless architecture?

Page 4: Serverless microservices in the wild

What is serverless?

● AWS Lambda is a compute service that lets you

run code without provisioning or managing servers

● Amazon API Gateway is a fully managed service

that makes it easy for developers to create,

publish, maintain, monitor, and secure APIs at any

scale

Page 5: Serverless microservices in the wild

Our serverless story

● We decided to create microservice to manage

shared configuration

Page 6: Serverless microservices in the wild

● No machine baby-sitting

● Forget rolling deployments

● Go from zero CPUs to 100s for 100 ms and die

● Practically free for cloud based tooling

● Enables “Event driven” architecture

● Enables “Nanoservices”

Serverless is Great!

Page 7: Serverless microservices in the wild

But there are new problems..(we <3 problems)

New Approaches

● Persisting state

● Fully utilizing resources (1 req/invocation)

● Configuration is integral to deployment

Loss of control

● Reproducing production locally

● Rate limits can surprise you

● API Gateway is a black box

● Monitoring and debugging hell

Page 8: Serverless microservices in the wild

Our serverless problems(we <3 problems)

How do we investigate issues?

● We can’t use existing tools (no ssh, ELK..)

● How can we get an overview of each endpoint

of our service?

● What errors are happening, and why?

● Why is our cache performing poorly?

Page 9: Serverless microservices in the wild

● How can we know what are these errors mean?

Page 10: Serverless microservices in the wild

Getting service level metrics via cloudwatch

● Export the swagger file describing API Gateway

● Collect relevant metrics about each resource +

Lambda function behind it

● rotemtam/serverless-metrics on GitHub

Page 11: Serverless microservices in the wild

How can we get insight into what’s really happening?

● API Gateway can write to CloudWatch Logs

● Unformatted, streaming data

● Search options aren’t very useful

● “Luck based debugging”

Page 12: Serverless microservices in the wild
Page 13: Serverless microservices in the wild

Enter: serverless logs pipeline

● Goal: get transaction level data to

Elasticsearch

Page 14: Serverless microservices in the wild

Challenges ● Managing subscriptions from CWL to Firehose

● Parsing Cloudwatch Logstreams

● A full transaction is fragmented between API

Gateway and Lambda

● Streaming data can be is cut-off at the ends,

we lose approx. 0.5% of transactions

Page 15: Serverless microservices in the wild

Resources:● Techniques and Tools for Better Serverless API Logging with Amazon API

Gateway and AWS Lambda (AWS Blog)● Subscribing CloudWatch Logs to Firehose

My OSS Node.js Projects:

● https://github.com/rotemtam/co-lambda-runner● https://github.com/rotemtam/serverless-ci-example● https://github.com/rotemtam/serverless-metrics● https://github.com/rotemtam/serverless-aws-logs-parser● https://github.com/rotemtam/mock-lambda-context