Rotem Tamir
Software 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
Questions?
Thank you!
rotem.tamir@ironsrc.com

Serverless microservices in the wild

  • 1.
    Rotem Tamir Software DevelopmentTeam Leader AtomData Running Serverless Microservices In the Wild
  • 2.
    About Me ● TeamLeader @ AtomData, a Data Flow Management platform by ironSource ● Full-stack Developer ● @_rtam on Twitter ● @rotemtam on Medium
  • 3.
    Before we begin ● Whois using serverless architecture?
  • 4.
    What is serverless? ● AWSLambda 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
  • 5.
    Our serverless story ● We decidedto create microservice to manage shared configuration
  • 6.
    ● No machinebaby-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!
  • 7.
    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
  • 8.
    Our serverless problems (we <3 problems) Howdo 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?
  • 9.
    ● How canwe know what are these errors mean?
  • 10.
    Getting service level metricsvia cloudwatch ● Export the swagger file describing API Gateway ● Collect relevant metrics about each resource + Lambda function behind it ● rotemtam/serverless-metrics on GitHub
  • 11.
    How can weget 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”
  • 13.
    Enter: serverless logs pipeline ●Goal: get transaction level data to Elasticsearch
  • 14.
    Challenges ● Managingsubscriptions 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
  • 15.
    Resources: ● Techniques andTools 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
  • 16.