如何在AWS nodejs lambda中获取V8 Heap快照?

发布于 2025-02-13 21:34:22 字数 490 浏览 1 评论 0原文

搜索最佳解决方案,以创建用Nodejs编写的AWS lambda创建堆快照。试图调用V8 Heap实用程序。统计数据有效,但一旦我想获得一个转储,它就会挂起:

  // 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()

任何想法?在AWS Lambda的背景下,这甚至可以吗?还有其他选择 - 我真的想获取内存细节,而不仅仅是统计数据吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文