Uh oh!
There was an error while loading. Please reload this page.
http2: use aliased buffer for perf stats, add stats - #18020
Conversation
There was a problem hiding this comment.
The net & fs APIs use bytesWritten and bytesRead for these values… might be worth being consistent with that?
Edit: Thinking about it, I would have a pretty strong preference for consistency, because that means we might be able to consolidate some of the code around handling C++ streams on the JS side…
There was a problem hiding this comment.
Just curious, why not use plain writable properties? Is that what we do in the rest of the perf API, or even spec-mandated?
There was a problem hiding this comment.
We can, it's not spec'd to require it.
There was a problem hiding this comment.
This could probably be merged with the line before.
There was a problem hiding this comment.
Can you move this into the http2 namespace? I'm kind of -1 on having perf-hooks require something within http2 itself.
There was a problem hiding this comment.
Not following. The collectStats method is in the internal/http2/util.js file. It is used here because we are instrumenting the http2 performance entry object with the http2 specific details, which must be done within this function.
There was a problem hiding this comment.
The rest of the code in perf_hooks is isolated from the rest of core. We are not loading fs, http, net etc to instrument them. Why do we need to load a part of http2?
There was a problem hiding this comment.
ah, ok, so move the collectStats method in to perf_hooks to keep from having to require anything from http2... yeah, I can do that.
There was a problem hiding this comment.
why do we need this for http2 while we don't for http or net?
There was a problem hiding this comment.
Neither http or netcurrently output any performance metrics via the perf_hooks API. That's something that's on my lower priority todo list. This is there for http2 because we're using an aliased buffer to move those data values out to js instead of setting properties on the object from within the C++ code -- it's far more efficient to do it this way. Eventually, once other bits of code are instrumented with perf_hooks output, similar mechanisms will be added. For instance, I'm planning on doing something similar with dns lookups fairly soon.
jasnell
commented
Jan 8, 2018
Updated to address the feedback. PTAL |
jasnell
commented
Jan 8, 2018
jasnell
commented
Jan 8, 2018
Add an aliased buffer for session and stream statistics, add a few more metrics
c416358 to
e5ddf5bComparejasnell
commented
Jan 8, 2018
Trying again with a possible fix for the seemingly unrelated failure: https://ci.nodejs.org/job/node-test-pull-request/12450/ |
jasnell
commented
Jan 8, 2018
apapirovski
commented
Jan 8, 2018
I'm reasonably certain this is not a flaky test. I ran it on my local environment against master and it succeeded. I ran a test against this PR and it fails. |
jasnell
commented
Jan 8, 2018
yeah, except this PR doesn't touch that code at all, which is quite strange. The only thing I can think of is that there's some weird interaction with AliasedBuffer. |
jasnell
commented
Jan 8, 2018
I'm thinking it has something to do with some alignment issue caused by the new aliased buffers. Trying a different fix. |
1b0bdd8 to
fbdf3b2Compareapapirovski
commented
Jan 8, 2018
It's not this PR directly. Just including |
jasnell
commented
Jan 8, 2018
perf_hooks is not used at all by the failing test |
apapirovski
commented
Jan 8, 2018
It's indirectly required by Anyway, a simple reproduction on master is: 'use strict';process.binding('http2');constcommon=require('../common');process.on('beforeExit',common.mustCall(()=>{setTimeout(common.mustNotCall(),1).unref();})); |
addaleax
commented
Jan 8, 2018
@apapirovski I can’t reproduce with that :/ And btw, this reminds me of 941c65b … |
fbdf3b2 to
89dfeb6Comparejasnell
commented
Jan 8, 2018
Yeah, that was my first thought too @addaleax but I couldn't find anything that was keeping the loop open. Trying something else... CI: https://ci.nodejs.org/job/node-test-pull-request/12453/ |
jasnell
commented
Jan 8, 2018
Ok, lazy loading the |
addaleax
commented
Jan 8, 2018
Yes, but that will have to wait until tomorrow :) |
Fishrock123
commented
Jan 8, 2018
I also cannot reproduce from master the way @apapirovski has. |
apapirovski
commented
Jan 8, 2018
@addaleax@Fishrock123 I'm guessing you're both on Windows? I can reproduce on Linux & macOS. |
Fishrock123
commented
Jan 8, 2018
I am currently using macOS 10.12.6. |
jasnell
commented
Jan 9, 2018
I'm unable to duplicate on Ubuntu VM or Windows. There really should not be anything in the |
Scheduling a PerformanceGCCallback should not keep the loop alive but due to the recent switch to using the native SetImmediate method, it does. Go back to using uv_async_t and add a regression test. PR-URL: nodejs#18051Fixes: nodejs#18047 Refs: nodejs#18020 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Scheduling a PerformanceGCCallback should not keep the loop alive but due to the recent switch to using the native SetImmediate method, it does. Go back to using uv_async_t and add a regression test. PR-URL: nodejs#18051Fixes: nodejs#18047 Refs: nodejs#18020 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell
commented
Jan 9, 2018
New CI now that #18051 landed: https://ci.nodejs.org/job/node-test-pull-request/12469/ |
Scheduling a PerformanceGCCallback should not keep the loop alive but due to the recent switch to using the native SetImmediate method, it does. Go back to using uv_async_t and add a regression test. Backport-PR-URL: #18050 PR-URL: #18051Fixes: #18047 Refs: #18020 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell
commented
Jan 9, 2018
This should be ready to go |
Add an aliased buffer for session and stream statistics, add a few more metrics PR-URL: #18020 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
jasnell
commented
Jan 9, 2018
Landed in a02fcd2 |
Add an aliased buffer for session and stream statistics, add a few more metrics PR-URL: #18020 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Scheduling a PerformanceGCCallback should not keep the loop alive but due to the recent switch to using the native SetImmediate method, it does. Go back to using uv_async_t and add a regression test. Backport-PR-URL: #18050 PR-URL: #18051Fixes: #18047 Refs: #18020 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Add an aliased buffer for session and stream statistics, add a few more metrics PR-URL: #18020 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Add an aliased buffer for session and stream statistics, add a few more metrics PR-URL: nodejs#18020 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Scheduling a PerformanceGCCallback should not keep the loop alive but due to the recent switch to using the native SetImmediate method, it does. Go back to using uv_async_t and add a regression test. PR-URL: #18051Fixes: #18047 Refs: #18020 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Scheduling a PerformanceGCCallback should not keep the loop alive but due to the recent switch to using the native SetImmediate method, it does. Go back to using uv_async_t and add a regression test. PR-URL: #18051Fixes: #18047 Refs: #18020 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Scheduling a PerformanceGCCallback should not keep the loop alive but due to the recent switch to using the native SetImmediate method, it does. Go back to using uv_async_t and add a regression test. PR-URL: #18051Fixes: #18047 Refs: #18020 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Add an aliased buffer for session and stream statistics, add a few more useful metrics
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
http2