serverless microservices in the wild
TRANSCRIPT
Rotem TamirSoftware Development Team Leader
AtomData
Running 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
Before we begin
● Who is using serverless architecture?
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
Our serverless story
● We decided to create microservice to manage
shared configuration
● 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!
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
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?
● How can we know what are these errors mean?
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
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”
Enter: serverless logs pipeline
● Goal: get transaction level data to
Elasticsearch
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
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