Profiling memory for a NodeJS Lambda function
Is there any tool, solution, framework, service or alike to allow memory profiling for NodeJS based lambda functions? Maybe even running on AWS directly and not on a local development environment? What would be the recommendation for such kind of profiling?
I'm aware that local profiling can be done using Chrome's Inspect / DevTools, but that actually means debugging a "long running process", not a short-lived one like a lambda function.
Additional Context:
We migrated a reporting service from an EC2 instance to a ECS Fargate based docker container using a basic lift & shift approach, but with the catch that we assigned less memory to the ECS Task than the original configuration of the EC2 instance purposely, as usually the instance had quite a lot of unused resources. So, now we are transitioning the "outliers" that fail with OutOfMemoryError into lambdas, but we'd like to improve their code and not just move them to a lambda container.
Jeff's questions are good. We may be able to provide more suggestions if you can answer those. In the meantime, one easy way to get basic insight into memory usage in a NodeJS script is to use the process.memoryUsage()
method. This article provides a nice overview with examples.
Relevant questions
Profiling memory for a NodeJS Lambda function
asked 5 months agoIs it possible to kill/stop a running lambda function?
asked 5 years agoHow to correctly deploy a NodeJS Lambda Function from Visual Studio 2022
asked 3 months agoLambda Memory Quota Inconsistent in São Paulo region
asked 2 months agoMax number of SQS as triggers for a single lambda?
Accepted Answerasked 2 years agoHow to create lambda function with nodejs from cloudformation inline?
Accepted Answerasked a year agoWhy is there a long delay between CREATE_IN_PROGRESS event for a Lambda-backed CloudFormation custom resource and the Lambda function invocation?
Accepted Answerasked 5 months agoCannot set Lambda memory larger than 3GB
asked 4 months agoLambda memory billing
Accepted Answerasked 3 years agoOn-demand parameterized nodejs lambda function on greengrass
asked 3 years ago
What is your goal for using a memory profiler? Are you running out of memory in some invocations? Are you trying to optimize memory usage to optimize the cost of Lambda? What details are you trying to capture that are missing from the the Lambda invocation logs that show the total memory used?