How "profile" server-side Javascript for Meteor?


#1

Using WebStorm 2016.1 with Meteor.
Want to be able to “profile” performance of Javascript for Meteor on server.

WebStorm has spy-js which is just what I need … however have not been able to get it to work with Meteor.
Cannot run 2 instances (Meteor and spy-js) at same time from one instance of WebStorm.
Running each on separate WS instances does not work either.
Start Meteor from terminal … then Run spy-js from WS … and then load Meteor prj from within WS (File::OpenURL → localhost:3000) … has not worked either.

Have looked at Kadira, Chrome DevTools, NodeJS profiling, JS profiling … but have not seen example of how they could work with server-side JS on Meteor.
I see Kadira has course (BulletProof Meteor) on Nodejs Internals (https://bulletproofmeteor.com/packages) … but course has been postponed (https://meteorhacks.com/postponing-nodejs-internals-lessons-on-bulletproof-meteor.html).

Best 2 solutions I have found:
#1 make CALL from client to server … and profile function that does CALL on client side in order to get idea of server performance.
#2 use console.time() and console.timeEnd() functions on server JS code.

I think I am missing something obvious … any suggestions?


#2

There is the Kadira Debug feature that can generate a flamegraph.

You can also use process.hrtime() to measure the time that some specific code needs.


#3

Thank you for your quick reply.
I thought there might be some “obvious” solution that I had missed.
I will definitely “bookmark” your two options!