there are some solutions for this.
The easiest with node clinic
You have to:
// install
npm install -g clinic
// run your process and see result
clinic doctor -- node my-process.js
// you can also use bubbleprof for network latency or flame for bottlenecks
When you stop the process or the process ends, doctor will create an HTML report with that information.
Another way to find the problem using standard node args:
// will generate a file isolate-0xnnnnnnnnnnnn-v8.log like (isolate-000001AADA5C7900-v8)
node --prof my-process.js
// to make it human readable
node --prof-process isolate-0xnnnnnnnnnnnn-v8.log > processed.txt
Another way is to:
// run your process with inspect:
node --inspect=0.0.0.0:9229 my-process.js
// then run chrome dev tools and connect it to <IP>:9229
go to this url on your Chrome: chrome://inspect/#devices
// then you will able to profile the cpu and take snapshots of memory usage
PS in the chrome dev tools you will see this in order to open:
