Xenophic Palo Alto Report
Xenophic Palo Alto Report
Xenophic Palo Alto Report
AWS Lambda
Trigger-based Lambda functions
Components of Serverless Architectures
APIs
Amazon API Gateway
Integration Points
Amazon VPC resources
Event Sources AWS service APIs
Amazon CloudWatch 3rd party services
Amazon S3 AWS Lambda
AWS Config Trigger-based Lambda functions
Amazon SNS
Data Enablement
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How Does FBA Work?
1 Send
Inventory
Warehouse
Management
Systems Kinesis
• Container reuse
• Instrument, measure and monitor
• Abstract Launch scaffolding from entity processing
• Canary and Dashboards
Best Practices that helped
• Container reuse
• Instrument, measure and monitor
• Abstract Launch scaffolding from entity processing
• Canary and Dashboards
Metrics and Instrumentation
if (adjustmentManager.doesAdjustmentAlreadyExist(metrics, adjustment)) {
// this adjustment already exists in our store. Nothing further needs to be done.
metrics.addCount(METRIC_IDEMPOTENT_CHECK_FAILED, 1, Unit.ONE);
log.debug("Adjustment already exists in DB. " + adjustment);
return null;
}
metrics.addCount(adjustment.getType().name(), 1, Unit.ONE);
metrics.addCount(String.join("#", adjustment.getSource().name(),
adjustment.getType().name()), 1, Unit.ONE);
Best Practices that helped
• Container reuse
• Instrument, measure and monitor
• Abstract Launch scaffolding from entity processing
• Canary and Dashboards
LambdaLaunchHelper
Invokes the appropriate event handler with the metrics instance and the
input
Event Handler is responsible for the deserialization of the items in the
request payload and invokes the Entity processor with the metrics instance
and the deserialized entity.
Common error/fault handling – writing to S3 and skipping the individual
entity at fault or fail the entire batch.
Common metrics
• Batch Size
• Total Time to process the batch
• Time to process an individual entity
• Entity Count in the batch
• Fault Count
Best Practices that helped
• Container reuse
• Instrument, measure and monitor
• Abstract Launch scaffolding from entity processing
• Canary and Dashboards
Canary and Availability of Pipeline
Average Transaction Processing Time Oldest Transaction Age Canary Processing Time
Serverless Logging &
Hot Key Detection
Brandon Cuff, Sr. Software Engineer, Scopely
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Scopely’s Mobile Games
Application uses Count Min Sketch to track top 10 keys then logs them
periodically (once per minute)
memcached-get-count topkey[1]: key=3.user.41401542 count=354 totalCount=68912 frequency=.00514
Lambda will take our log message and convert it into an Elasticsearch
document
memcached-get-count topkey[1]: key=3.user.41401542 count=354 totalCount=68912 frequency=.00514
{
...
"topkey_category": "memcached-get-count",
"topkey_key": "3.user.41401542",
"topkey_count": 354,
"topkey_totalCount": 68912,
"topkey_frequency": .00514
}
Kibana Dashboard
Results & Lessons Learned
We Had More Bugs Than We Thought We Did!
We can look for unusually large keys if we increment by the size of objects
rather than 1
memcached-get-count topkey[1]: key=3.Dice.inv.21645428 size=20354 totalCount=1008912 frequency=.0203
You can get the total bandwidth consumed by a specific key by summing the
events over a time period.
We Caught Some Bots and Spammers
github.com/bcuff
Thank you!
Remember to complete
your evaluations!
Related Sessions