Also searching for the best solution to create a heap snapshot from AWS Lambda written in NodeJS. Tried to call V8 heap utilities. Statistics works but as soon as I want to get a dump, it hangs:
// THIS WORKS. console.log("Heap space stats = ", v8.getHeapSpaceStatistics()) console.log("Heap code stats heapdump = ", v8.getHeapCodeStatistics()) console.log("Heap stats = ", v8.getHeapStatistics()) // THIS HANGS. console.log("Getting heapdump...") const snapshotStream = v8.getHeapSnapshot()
Any idea why? Is this even possible in the context of AWS Lambda? Any alternative - I'd really like to get memory details, not just stats?
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.
RE :Lambda Memory exceededasked 3 months ago
Max number of SQS as triggers for a single lambda?Accepted Answerasked 3 years ago
Lambda Memory Quota Inconsistent in São Paulo regionasked 6 months ago
Is it possible to kill/stop a running lambda function?asked 6 years ago
Is there a way to recover the deleted lambda function?asked 3 months ago
Profiling memory for a NodeJS Lambda functionasked 9 months ago
Force my AWS Lambda function to use X memoryasked 3 months ago
Lambda memory billingAccepted Answerasked 3 years ago
Cannot set Lambda memory larger than 3GBasked 8 months ago
On-demand parameterized nodejs lambda function on greengrassasked 3 years ago