You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See bnoordhuis/node-profiler#11 for background. A recurring issue with CPU profiling with --prof is that you either need to build d8 (the V8 shell) or install a tick processor package from npm.
The problem with building d8 is that it's quite tedious and frequently broken due to the way V8 is bundled. Installing a tick processor is no picnic either; if it doesn't match the V8 version, it produces bogus output. That isn't currently solvable from user land because the output from the profiler doesn't contain version information and heuristics aren't reliable enough. I'm going to prepare a patch that adds version information but that is a tangential issue. (Update: https://codereview.chromium.org/800293002/)
For ease of use, I propose bundling the tick processor with iojs, either as a standalone JS script (working name: ioprof) or by baking it into the binary. The former would be easiest short-term, the latter offers an arguably nicer user experience. I volunteer to do the work.
Design decisions:
Add a --without-ioprof to the configure script, similar to the --without-npm flag? Assertion without hard data to back it up: no one uses --without-npm; --without-ioprof is probably not worth the hassle.
What about distro packagers that build against an external V8? We would normally copy the tick processor files from deps/v8/tools but that won't work when compiling against headers only. The best I can come up with for now is to disable the profiler script when --shared-v8 is specified. Maybe @jbergstroem can chime in here.
would be good if bundled processor is able to consume version different from processor's associated distribution. (Someone email me v8.log, or node version on server that produced log is not the version I have on dev machine) - via command line switch ( for example, --log-version ), auto-detect, or using version tag in log file once we start to put it
another requirement (that's what processor shipped with v8 doesn't do) - don't buffer entire log file and process it as a stream. few minutes of profiling can easily generate gigabytes of v8.log
@bnoordhuis I don't think there's any distros left that aims to decouple V8 (node/io.js would just be one example package). It's neigh impossible since every binary linking to it usually expects a different version. Since V8 might not be the best example of a consistent ABI, the effort to keep these versions apart is pretty painful. What I've seen done though is building it separately from the ordinary build in order to manage the environment (PaX-marking, specific stuff for arm, etc). I'll go through a few package managers and see if I can find any that still decouples it.
As for the npm analogy, I'd say that the primary use for --without-npm is not about avoiding to use it, rather having better control of the npm installation. I agree with --without-ioprof being pointless.
would be good if bundled processor is able to consume version different from processor's associated distribution. (Someone email me v8.log, or node version on server that produced log is not the version I have on dev machine) - via command line switch ( for example, --log-version ), auto-detect, or using version tag in log file once we start to put it
That doesn't really work and probably never will, at least not for C/C++ symbols. A lesser issue is that every tick processor version adds about 60 kB, unless you get creative with compression; it's not much but it adds up.
It would make for a nice feature once those issues have been worked out but I think it's out of scope for now.
@bnoordhuis You're right - didn't know that. Seems like they try to pinpoint minor versions. I think their mongodb package illustrates the issues rather well though; they require 3.14+ while upstream recommends either 3.12.x or 3.25.x. It's really tricky and the test suites for packages (node, mongodb, rethinkdb, etc) wouldn't be reliable enough to verify that whatever version [of v8] you have installed is working as intended. Building and using v8 as a shared library is a very fragile situation. When I used to maintain it, build errors were the "best" way of knowing if you had a problem.
I'm +1 on this & adding a section to the docs explaining how (and when) to use the profiler.
Something to keep in mind re: --without-ioprof -- some package distributions (EPEL comes to mind) rely on being able to split out the dependencies of node into separate packages. I imagine they'd be grateful if we gave them the tools to continue doing that. This is a bit of a foggy concern since I'm not entirely sure what would go into baking ioprof into the executable would involve.
Agreement from TC in today's meeting that this is fine to add. The only cause for concern was in setting a precedent for adding minor functionality like this but it was agreed that this is a special case.
+1 on this. the tick processor is intimately tied to internal details of node's v8, so makes an excellent candidate for distribution with node, and I have had poor luck with the the npmjs.org module that is supposed to build it.
It uses the C++ API to programmatically start and stop the profiler. The returned profile does not have detailed information for C++ stack frames like --prof + linux-tick-processor + nm has.
I try to profile this script with Node 0.10.37 on the Max OS X 10.10: node --prof sorting.js. node-tick shows this result: http://pastebin.com/8Xmva4xz Looks like correct profile.
Activity
sidorares commentedon Dec 14, 2014
would be good if bundled processor is able to consume version different from processor's associated distribution. (Someone email me v8.log, or node version on server that produced log is not the version I have on dev machine) - via command line switch ( for example,
--log-version), auto-detect, or using version tag in log file once we start to put itanother requirement (that's what processor shipped with v8 doesn't do) - don't buffer entire log file and process it as a stream. few minutes of profiling can easily generate gigabytes of v8.log
jbergstroem commentedon Dec 14, 2014
@bnoordhuis I don't think there's any distros left that aims to decouple V8 (node/io.js would just be one example package). It's neigh impossible since every binary linking to it usually expects a different version. Since V8 might not be the best example of a consistent ABI, the effort to keep these versions apart is pretty painful. What I've seen done though is building it separately from the ordinary build in order to manage the environment (PaX-marking, specific stuff for arm, etc). I'll go through a few package managers and see if I can find any that still decouples it.
As for the npm analogy, I'd say that the primary use for
--without-npmis not about avoiding to use it, rather having better control of the npm installation. I agree with--without-ioprofbeing pointless.bnoordhuis commentedon Dec 14, 2014
@sidorares
That doesn't really work and probably never will, at least not for C/C++ symbols. A lesser issue is that every tick processor version adds about 60 kB, unless you get creative with compression; it's not much but it adds up.
It would make for a nice feature once those issues have been worked out but I think it's out of scope for now.
@jbergstroem
I think Fedora still does; its v8 package is shared between nodejs, mongodb and a few more.
jbergstroem commentedon Dec 14, 2014
@bnoordhuis You're right - didn't know that. Seems like they try to pinpoint minor versions. I think their mongodb package illustrates the issues rather well though; they require 3.14+ while upstream recommends either 3.12.x or 3.25.x. It's really tricky and the test suites for packages (node, mongodb, rethinkdb, etc) wouldn't be reliable enough to verify that whatever version [of v8] you have installed is working as intended. Building and using v8 as a shared library is a very fragile situation. When I used to maintain it, build errors were the "best" way of knowing if you had a problem.
bajtos commentedon Dec 15, 2014
+1
@bnoordhuis @rvagg perhaps this issue can be discussed in your next TC meeting on Dec 17th?
chrisdickinson commentedon Dec 15, 2014
I'm +1 on this & adding a section to the docs explaining how (and when) to use the profiler.
Something to keep in mind re:
--without-ioprof-- some package distributions (EPEL comes to mind) rely on being able to split out the dependencies of node into separate packages. I imagine they'd be grateful if we gave them the tools to continue doing that. This is a bit of a foggy concern since I'm not entirely sure what would go into baking ioprof into the executable would involve.rvagg commentedon Dec 17, 2014
Agreement from TC in today's meeting that this is fine to add. The only cause for concern was in setting a precedent for adding minor functionality like this but it was agreed that this is a special case.
rvagg commentedon Dec 17, 2014
Sorry, TC minutes are in #178
AndreasMadsen commentedon Jan 6, 2015
Thanks for doing this. This have always been a major problem when teaching people to solve performance problems.
Fishrock123 commentedon Jan 29, 2015
@bnoordhuis is this still something that is happening?
bnoordhuis commentedon Jan 29, 2015
Yes, once I get the quirks (they're not really bugs) ironed out.
sam-github commentedon Feb 2, 2015
+1 on this. the tick processor is intimately tied to internal details of node's v8, so makes an excellent candidate for distribution with node, and I have had poor luck with the the npmjs.org module that is supposed to build it.
5 remaining items
bnoordhuis commentedon Mar 22, 2015
@Andre-487 v8-profiler doesn't profile C++ code. Or rather, it does but it dumps it all in one big bucket named
(program)(IIRC.)sidorares commentedon Mar 22, 2015
@bnoordhuis iwith debug symbols and
nminstalled it gives you C++ profile as well ( or used to, need to check ) - https://gist.github.com/sidorares/9521922#file-with-nm-txt-L12bnoordhuis commentedon Mar 22, 2015
@sidorares I mean v8-profiler, not node-tick.
sidorares commentedon Mar 22, 2015
@bnoordhuis I thought it's based on the same V8 scripts as node-tick
bnoordhuis commentedon Mar 22, 2015
To be clear, I'm talking about this module: https://github.com/node-inspector/v8-profiler :-)
It uses the C++ API to programmatically start and stop the profiler. The returned profile does not have detailed information for C++ stack frames like
--prof+ linux-tick-processor + nm has.Olegas commentedon Mar 23, 2015
@sidorares Is there any working way to analyze v8.log visually (i.e. with about://tracing or via exporting to .cpuprofile)
sidorares commentedon Mar 23, 2015
@Olegas yes, look at https://github.com/thlorenz/v8-perf/blob/master/performance-profiling.md#using-chrome
andre487 commentedon Mar 23, 2015
Looks like I was wrong.
I try to profile this script with Node 0.10.37 on the Max OS X 10.10:
node --prof sorting.js. node-tick shows this result: http://pastebin.com/8Xmva4xz Looks like correct profile.But on the 0.12.0 it shows this: http://pastebin.com/JVZrQDsY There is no 80% time in system libraries in profile: http://pastebin.com/ZSXekRpg, but 11% in node is questionable.
bnoordhuis commentedon Jun 26, 2015
Closing this for now. I have semi-working code sitting in a branch but it needs some V8 fixes that I don't have time for right now.
ofrobots commentedon Jun 26, 2015
FWIW, we are looking at making the V8 tick processor directly usable using node. See https://codereview.chromium.org/1179173009/
/cc @matthewloring
trevnorris commentedon Jun 26, 2015
@ofrobots Looks great. Thanks for letting us know.
Node API rename (nodejs#158)