Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to profile a Nest.js application by using node CLI command?

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.

like image 265
jeongmin.cha Avatar asked Aug 28 '26 13:08

jeongmin.cha


1 Answers

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

like image 142
Jay McDoniel Avatar answered Aug 31 '26 06:08

Jay McDoniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!