PERF 1: How do you optimize your Serverless application’s performance?

Evaluating and optimizing your Serverless application’s performance based on access patterns, scaling mechanisms, and native integrations allows you to continuously gain more value per transaction.

Resources

Serverless Hero: Reusing Database Connections in AWS Lambda
re:Invent 2019 - Best practices for AWS Lambda and Java
re:Invent 2019 - I didn’t know Amazon API Gateway did that
re:Invent 2019 - Serverless at scale: Design patterns and optimizations

Best Practices:

Improvement Plan

Measure, evaluate, and select optimum capacity units

  • Identify and implement optimum capacity units.
  • Integrate with managed services directly over functions when possible

  • Utilize native cloud service integrations.
  • Measure and optimize function startup time

  • Analyze and improve startup time.
  • Take advantage of execution context reuse to improve the performance of your function.
  • Minimize your deployment package size to only its runtime necessities.
  • Take advantage of concurrency via async and stream-based function invocations

  • Favor asynchronous over synchronous request-response processing.
  • Tune batch size, batch window and compress payloads for high throughput.
  • Optimize access patterns and apply caching where applicable

  • Implement caching for suitable access patterns.
  • Reduce overfetching and underfetching
  • Compress payload and data storage