How to get V8 heap snapshot in AWS NodeJS Lambda?

Viewed 50

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?

0 Answers
Related