如何使用 Node CLI 命令分析 Nest.js 应用程序?

jeo*_*cha 5 profiling intellij-idea node.js webstorm nestjs

我一直在为 REST API 服务器开发 Nest.js 应用程序,并且想使用 Node.js 分析工具进行一些性能分析。我知道有几种工具,例如 WebStorm V8 CPU 和内存分析(https://www.jetbrains.com/help/webstorm/v8-cpu-and-memory-profiling.html#node_profiling_before_you_start)和节点 CLI 选项--prof

但是,我不知道如何使用nodeCLI 程序启动我的 Nest.js 应用程序,因此我不知道如何将这些分析工具应用到我的 Nest.js 应用程序中。

有什么方法可以使用 Node.js 分析工具对 Nest.js 应用程序进行分析吗?或者对于Nest.js应用还有其他好的解决方案吗?

提前致谢。

Jay*_*iel 12

您可以使用构建应用程序nest build,然后使用运行它node --prof dist/main。或者你可以只使用nest start --watch -e 'node --prof'which 告诉 Nest 用于node --prof dist/main启动命令