Home > Software engineering >  How to profile a Nest.js application by using node CLI command?
How to profile a Nest.js application by using node CLI command?

Time:11-30

I has been developing a Nest.js application for a REST API server, and I want to do some performance analysis by using Node.js profiling tools. I know that there are several tools like WebStorm V8 CPU and Memory Profiling (https://www.jetbrains.com/help/webstorm/v8-cpu-and-memory-profiling.html#node_profiling_before_you_start) and node CLI option --prof.

However, I don't know how to start my Nest.js application by using node CLI program, so I don't know how to apply these profiling tools to my Nest.js application.

Is there any way to use Node.js profiling tools to Nest.js application? Or is there any other good solutions for Nest.js application?

Thanks in advance.

CodePudding user response:

You could build the application using nest build and then run it using node --prof dist/main. Or you could just use nest start --watch -e 'node --prof' which should tell Nest to use node --prof dist/main for the start command

  • Related