Metricly now ingests a combination of CloudWatch logs to compute the memory utilization for a given Lambda function, calculated off the max used and billable memory values. Check out the Lambda Sizing Tool Admin Guide for a detailed breakdown of this tool.
How it Works
Lambda function pricing is based on memory allocation, not actual usage. Your function’s actual memory usage is logged in CloudWatch. We use the log information to calculate your usage against the function’s allocated memory and aggregate it over time for you to filter and sort.
- Lambda function executes every five minutes.
- Lambda usage reporting logs are collected.
- CloudWatch Logs are then parsed to produce Metricly samples.
- Samples are collapsed into a single ingest payload and sent to Metricly.
What Can I do With it?
Use this computed memory utilization metric (aws.lambda.memory.utilization) to target oversized Lambda functions. Functions require at least 128mb of memory to run, so keep that in mind when looking for candidates to resize. Not every function is a good candidate for downsizing.
Here’s a high-level workflow for discovering and resizing Lambda functions:
- Check the amount of RAM used.
- Determine volatility.
- Gauge CPU usage .
- Consider invocation durations; less RAM may elongate duration if CPU bound.
- Factor in primary functions; network heavy functions respond to memory reductions better than CPU heavy functions.
- Monitor performance.
- Refactor if/when necessary.