2. A real life experience
TRACKING
A tracking app for bikers
REST API
More than 70 API
TRAFFIC
1000+ RPD in beta
SOCIAL
Friends, group itineraries...
SERVERLESS
What else? :-)
3. Why serverless?
NO SERVERS TO MANAGE
Just write your code
FLEXIBLE SCALING
Scale just a given function
AUTOMATED HA
Provided by the service
NO UPFRONT COST
Just pay for what you use
4. Building blocks
≪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. [...] You can create an
API that acts as a “front door” for [...] your back-end services
[...] running on AWS Lambda.≫
≪AWS Lambda lets you run code without provisioning
or managing servers. You pay only for the compute time
you consume [...]. With Lambda, you can run code [...]
with zero administration. Just upload your code and
Lambda takes care of everything required to run and
scale your code with high availability.≫
9. Many questions
WHEN
Always? When error happens?
WHERE
Any critical regions in source code?
WHY
Low Memory? A bug? A leak?
WHAT
All Lambdas? Just one? Two?
15. Amazon Elasticsearch Service
≪Amazon Elasticsearch Service is a
managed service that makes it easy to
deploy, operate, and scale Elasticsearch
clusters in the AWS Cloud.≫
22. Third issue
IT’S JUST A PIECE
What about API Gateway latencies?
IDEA
Stream and index API Gateway logs
23. Integration latency
(5d1...bb3) Received response.
⤷Integration latency: 7126 ms
(*) The time between when API Gateway relays a request to the backend and when it receives a response from it.
24. Integration latency indexing
var regex = /^(([0-9A-Fa-f-]{36})) Received response. Integration latency: ([0-9]*) ms$/g;
var parts = regex.exec(log.message);
// ...
body["@id"] = parts[1];
body.api_gw_integration_latency = Number(parts[2]);
// ...
28. Fourth issue
HIGH LATENCY
Why Integration latency is much greater than Lambda duration?
7126 ms >> 4529.12 ms
IDEA
Digging deeper into Lambda executions
37. Further developments
MORE SERVICES
Push new log types into ElasticSearch (e.g. CodeBuild?, CloudTrail?)
GRAPHIC CORRELATION
Did this deploy negatively affect Lambda execution times?
CACHED REQUEST
Cache hits vs Cache misses