-
Notifications
You must be signed in to change notification settings - Fork 47
Perf/Node.js #168
Comments
I went through the guide to generate a flamegraph and I see a lot of "ByteCodeHandler:xxxx" |
Yes, |
@nodejs/diagnostics as an FYI |
I can confirm as well. From my in-the-wild experimentation, generating those diagram is still useful: they point at a likely bottleneck of your application. Most hot code gets optimimized by turbofan under load, so it is not a blocker. However if you plan to diagnose the boot sequence then it is is. |
talking with @bmeurer he also pointed out that code can be de-optimized as well and in that case even if it is under load this can be a problem. |
Just to recap for those who do not have the full context: Previously, V8 would always run native JIT code. Linux perf or similar tools would periodically walk the stack and collect PCs from every frame. Those PCs can be attributed to individual code objects, each corresponding to one or more (in case of inlining) functions in the source code. With the bytecode interpreter (Ignition), this is no longer possible. The bytecode interpreter executes on bytecode handlers, code snippets that correspond to each bytecode. By walking the stack, interpreted frames would only show PCs inside those handlers, which do not correspond to any particular function. There are some ideas to fix this:
@fhinkel |
@hashseed Good summary. Fact-check passed 👍 There are also additional complications with moving bytecode array code objects, that you need to get right with Maybe we can really beef up |
Upstream bug: v8:7155 |
It's not easy. I tried this approach with eBPF I didn't explore the second approach yet, but it seems promising. In theory, it would work for any external tool which worked before Ignition (without changing those external tools). If the V8 team would be ok with this approach, I can give it a try. Otherwise, I'll work on the third approach.
I don't think that's an issue because we can remove those frames after we collect them (post-processing the output from Linux perf, for example)
I'm not sure I understood this part. Could you please elaborate? |
With the second approach, you can find out which function is on the stack, but not where inside the function you collected the sample from. I.e. you can't figure out which source line exactly the tick comes from. /cc @fhinkel Also, thanks a lot for experimenting with the options! |
@hashseed thanks, now I understood :) I think Linux perf wasn't able to tell the exact line before Ignition either, just where the function was declared. I'll confirm that though |
This is being covered in nodejs/diagnostics#148. I suggest closing this issue here. |
Closing as covered by nodejs/diagnostics#148 |
@bmeurer you mentioned something in passing in the last meeting about the change in pipeline affecting the results from perf (I think).
Given that the diagnostics WG is documenting nodejs/nodejs.org#1444 I think it confirms there is interest and I wanted to follow up to see if what you had mentioned would affect this workflow.
The text was updated successfully, but these errors were encountered: