Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async_hooks,http: set HTTPParser trigger to socket #18003

Closed
wants to merge 3 commits into from
Closed

async_hooks,http: set HTTPParser trigger to socket #18003

wants to merge 3 commits into from

Conversation

AndreasMadsen
Copy link
Member

This allows more easy tracking of where HTTP requests come from. Before
this change the HTTPParser would have the HTTPServer as the
triggerAsyncId.

The HTTPParser will still have the executionAsyncId set to the HTTP
Server so that information is still directly available. Indirectly, the
TCP socket itself also has its triggerAsyncId set to the TCP Server.

NOTE: this should properly be benchmarked

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

async_hooks, http

/cc @nodejs/async_hooks

@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Jan 5, 2018
@AndreasMadsen AndreasMadsen added async_hooks Issues and PRs related to the async hooks subsystem. http Issues or PRs related to the http subsystem. semver-minor PRs that contain new features and should be released in the next minor version. labels Jan 5, 2018
Copy link
Member

@apapirovski apapirovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Would like to see my first comment addressed before this lands though as it'll have a performance impact (and would also reduce the number of changes required).

@@ -273,7 +277,9 @@ function Server(requestListener) {
// http://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F
this.httpAllowHalfOpen = false;

this.on('connection', connectionListener);
this.on('connection', (socket) => defaultTriggerAsyncIdScope(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is hot path listener, this should be refactored to not have a closure. The fact that an Array is now created each time is also problematic.

Could we perhaps instead keep all the connectionListener references as is, then rename connectionListener to something like internalConnectionListener and have the connectionListener invoke the defaultTriggerAsyncIdScope with internalConnectionListener? That way there's no need to make changes in https or http2.

(Also, I'll open a PR shortly to update defaultTriggerAsyncIdScope for performance.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I had in mind: a530e8f — you should be able to apply it as a patch if you want.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe, sorry. Already done it locally, running tests ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. Just put it together in case I wasn't being clear and/or you didn't have time to work on it :)

@@ -248,6 +248,12 @@ function newUid() {
return ++async_id_fields[kAsyncIdCounter];
}

function getOrSetAsyncId(object) {
if (object.hasOwnProperty(async_id_symbol)) return object[async_id_symbol];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super minor nit: can we add a line break before return? I find these same line if-return statements really hard to read.

@AndreasMadsen AndreasMadsen added the blocked PRs that are blocked by other issues or PRs. label Jan 5, 2018
@AndreasMadsen
Copy link
Member Author

}));
server.listen(0, common.mustCall());

http.get(`http://127.0.0.1:${server.address().port}`, common.mustCall());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be moved inside the listening event handler? Wonder if this could possibly end up being flaky

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with Evan's nit addressed.

@AndreasMadsen
Copy link
Member Author

Copy link
Contributor

@maclover7 maclover7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as long as benchmarks look ok. It looks like the last run errored out and needs to be rerun.

@AndreasMadsen
Copy link
Member Author

@maclover7 Yes, we didn't have wrk installed on the server. It is fixed now.

Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/88/

@addaleax
Copy link
Member

addaleax commented Jan 8, 2018

@AndreasMadsen Fyi, that benchmark CI has been running for nearly 40 hours now… do you think it would be okay to cancel it? The HTTP benchmarks take a lot longer than the other ones for some reason… :/

@AndreasMadsen
Copy link
Member Author

AndreasMadsen commented Jan 8, 2018

@addaleax I've stopped it, not sure why it takes so long. I set it to only test simple.js. I will look at it :/

@AndreasMadsen
Copy link
Member Author

AndreasMadsen commented Jan 8, 2018

  1. The default benchmark parameters are set to run the benchmarker for 10 seconds.
  2. In the http/simple.js benchmark, there are 2 * 3 * 2 * 2 * 2 * 3 = 144 parameter combinations.
  3. I set it to run 100 iterations on the old and new version.

The expected wall time is thus:

144 * 2 * 100 * 10s = 80h

As such there are two solutions to this.

  1. have fewer parameter combinations
  2. reduce the number of iterations

I looked at the 95% confidence interval to see if fewer iterations will do (it did 54 before I stopped it):

benchmark results
                                                                                                        improvement accuracy confidence
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"             -0.90 %  ±2.65 %
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"               0.33 %  ±2.39 %
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"            1.49 %  ±4.07 %
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"             1.81 %  ±1.93 %
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"                 2.38 %  ±3.03 %
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"                  0.37 %  ±2.46 %
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"              0.13 %  ±2.37 %
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"               0.25 %  ±2.02 %
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"            0.28 %  ±3.89 %
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"            -4.52 %  ±1.75 %        ***
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"                -1.05 %  ±1.83 %
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"                  0.46 %  ±2.43 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"            -3.17 %  ±3.79 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"              0.07 %  ±3.09 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"          -2.00 %  ±4.84 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"            1.26 %  ±2.05 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"                0.50 %  ±3.56 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"                 1.84 %  ±3.03 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"             0.27 %  ±3.62 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"              0.59 %  ±3.34 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"           3.92 %  ±4.13 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"            0.43 %  ±3.15 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"                2.75 %  ±4.02 %
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"                 1.40 %  ±3.46 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"              1.35 %  ±2.68 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"               0.89 %  ±2.42 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"           -0.85 %  ±3.52 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"           -18.38 %  ±3.19 %        ***
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"                 1.28 %  ±2.61 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"                  0.41 %  ±2.52 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"             -0.60 %  ±1.83 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"              -1.06 %  ±2.09 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"            3.37 %  ±3.51 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"             1.90 %  ±3.90 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"                -1.10 %  ±2.14 %
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"                 -1.18 %  ±1.99 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"             3.77 %  ±3.92 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"              1.36 %  ±3.42 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"          -0.44 %  ±4.35 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"            5.54 %  ±3.45 %         **
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"                0.68 %  ±3.40 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"                 0.42 %  ±3.71 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"             0.28 %  ±4.28 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"             -0.86 %  ±4.18 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"           1.92 %  ±3.62 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"            3.27 %  ±4.03 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"                2.53 %  ±4.61 %
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"                 0.32 %  ±4.36 %
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"          -2.55 %  ±2.74 %
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"            0.13 %  ±2.09 %
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"        -1.46 %  ±3.76 %
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"         -3.14 %  ±2.34 %         **
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"              1.33 %  ±3.12 %
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"              -0.49 %  ±2.88 %
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"          -1.31 %  ±2.47 %
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"           -0.34 %  ±2.42 %
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"         2.14 %  ±3.91 %
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"         -3.44 %  ±1.77 %        ***
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"              1.67 %  ±2.51 %
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"               0.09 %  ±2.08 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"         -0.26 %  ±3.79 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"           0.02 %  ±3.96 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"       -3.92 %  ±4.57 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"         1.10 %  ±2.19 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"            -1.28 %  ±3.42 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"             -1.69 %  ±3.41 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"         -1.01 %  ±3.71 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"          -0.09 %  ±3.80 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"       -1.19 %  ±4.04 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"         1.41 %  ±3.19 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"            -2.15 %  ±3.79 %
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"             -4.30 %  ±4.01 %          *
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"           1.43 %  ±2.75 %
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"            0.21 %  ±2.91 %
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"        -2.12 %  ±3.98 %
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"        -14.56 %  ±2.61 %        ***
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"             -1.89 %  ±2.97 %
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"              -0.08 %  ±2.22 %
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"          -0.54 %  ±2.70 %
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"           -1.15 %  ±2.08 %
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"         0.24 %  ±3.32 %
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"          1.48 %  ±4.00 %
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"             -0.17 %  ±2.35 %
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"               1.09 %  ±2.29 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"         -0.58 %  ±3.52 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"           1.09 %  ±4.22 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"       -1.68 %  ±3.72 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"         1.25 %  ±3.64 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"             1.96 %  ±3.46 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"              0.98 %  ±4.08 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"          1.78 %  ±3.69 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"           2.44 %  ±4.56 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"        2.71 %  ±3.81 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"        -0.23 %  ±4.04 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"             1.25 %  ±4.69 %
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"             -4.10 %  ±4.43 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"         0.29 %  ±2.94 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"         -1.72 %  ±2.53 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"       0.08 %  ±3.99 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"       -0.54 %  ±2.86 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"            1.21 %  ±2.70 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"            -0.44 %  ±2.91 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"         0.20 %  ±2.63 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"          0.99 %  ±2.52 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"       1.10 %  ±4.14 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"       -3.95 %  ±2.19 %        ***
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"            0.83 %  ±2.80 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"             1.22 %  ±2.14 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"        0.99 %  ±3.59 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"        -2.20 %  ±3.35 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"      7.79 %  ±3.89 %        ***
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"      -0.87 %  ±2.15 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"          -0.75 %  ±3.91 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"            0.77 %  ±3.78 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"        0.84 %  ±3.73 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"        -1.69 %  ±3.86 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"     -1.10 %  ±3.64 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"      -1.55 %  ±4.26 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"          -0.67 %  ±4.19 %
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"           -3.44 %  ±4.15 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"        -0.54 %  ±2.59 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"         -0.95 %  ±2.59 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"      -3.51 %  ±3.58 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"      -16.89 %  ±3.13 %        ***
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"           -1.25 %  ±2.73 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"             0.15 %  ±2.20 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"        -0.22 %  ±2.34 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"          2.24 %  ±2.23 %          *
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"       2.21 %  ±3.69 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"        0.98 %  ±3.48 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"            0.22 %  ±2.47 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"             0.20 %  ±2.44 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"        0.07 %  ±3.74 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"        -2.76 %  ±4.07 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"      1.61 %  ±3.71 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"       0.22 %  ±3.45 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"          -1.64 %  ±3.93 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"            1.38 %  ±4.47 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"        0.94 %  ±3.72 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"         2.63 %  ±4.01 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"      2.40 %  ±3.44 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"       3.70 %  ±4.29 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"          -1.13 %  ±4.29 %
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"           -0.74 %  ±4.69 %

If a confidence interval between 2% and 4% is acceptable, then 50 iterations are enough. This will result in an expected run time of 40 hours :/

In terms of parameters, it looks like http/simple.js is testing both the performance of res.setHeader() and res.write(). Properly these are reasonably independent, we should thus split the benchmark into two separate benchmarks. One for res.setHeader and one for res.write. The wall time would then be:

  • res.write: 13.3 hours
  • res.setHeader: 0.8 hours

@apapirovski
Copy link
Member

Just an FYI, #18004 landed so this needs to be slightly updated to account for the new function signature.

@AndreasMadsen AndreasMadsen removed the blocked PRs that are blocked by other issues or PRs. label Jan 9, 2018
This allows more easy tracking of where HTTP requests come from. Before
this change the HTTPParser would have the HTTPServer as the
triggerAsyncId.

The HTTPParser will still have the executionAsyncId set to the HTTP
Server so that information is still directly available. Indirectly, the
TCP socket itself also has its triggerAsyncId set to the TCP Server.
@AndreasMadsen
Copy link
Member Author

Rebased with the performance improvements in #18004, so I will run a new benchmark.

CI: https://ci.nodejs.org/job/node-test-pull-request/12484/
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/91/

@addaleax
Copy link
Member

@AndreasMadsen Should that benchmark CI run that you triggered be expected to run 40 hours wall clock time, like you estimated? That might be nice to know to plan other benchmark CI runs…

@AndreasMadsen
Copy link
Member Author

@addaleax Oh, yeah – sorry. I forgot about that estimate. Although, I'm not really sure what the alternative is right now.

It would be nice if we were more strict about our benchmarks such that they don't take so much time. But that is a major initiative.

@AndreasMadsen
Copy link
Member Author

There are 4 significant results at a 95% confidence level. Since this benchmark contains 144 combinations and there is a 5% risk for false positives, we should expect 144 * 5% = 7.2 results to show significance even if there is no difference in reality. 4 significant is well within that, thus I think it is safe to say that there is no measurable difference.

                                                                                                         improvement confidence    p.value
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"          -0.88 %            0.71511856
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"           -0.69 %            0.48458501
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"            -2.33 %            0.15684229
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"             -1.55 %            0.35268222
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"                0.63 %            0.78518795
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"                 3.26 %            0.10361214
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"          -0.46 %            0.85081645
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"            2.47 %            0.09661026
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"            -1.48 %            0.44589131
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"              2.07 %            0.26962546
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"               -0.95 %            0.59109904
 http/simple.js res="normal" chunkedEnc=0 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"                -0.17 %            0.92001136
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"           -0.36 %            0.84921710
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"            -0.92 %            0.31243308
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"             -0.98 %            0.53426291
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"              -0.70 %            0.60893411
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"                 0.54 %            0.75680237
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"                  1.39 %            0.35170705
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"           -3.04 %            0.15917164
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"            -2.11 %            0.06711455
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"              2.66 %            0.07937116
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"               0.14 %            0.92908148
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"                -1.28 %            0.39110237
 http/simple.js res="normal" chunkedEnc=0 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"                 -2.45 %            0.08255405
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"           1.30 %            0.55955613
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"           -1.23 %            0.47252154
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"            -0.89 %            0.62026944
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"              1.58 %            0.46246026
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"               -2.48 %            0.12670996
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"                 3.60 %            0.05717524
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"           0.95 %            0.59356069
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"            1.15 %            0.62118541
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"            -0.12 %            0.95482602
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"              3.11 %            0.16992390
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"                3.21 %            0.11639364
 http/simple.js res="normal" chunkedEnc=1 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"                 0.34 %            0.88033409
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"           -2.08 %            0.26823123
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"             1.58 %            0.38056120
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"             -0.85 %            0.62511454
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"               0.17 %            0.90568051
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"                -2.48 %            0.05131205
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"                 -0.77 %            0.62770520
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"            2.34 %            0.25839860
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"             2.54 %            0.19395417
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"              0.49 %            0.68257723
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"              -0.95 %            0.40315054
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"                -0.91 %            0.32455381
 http/simple.js res="normal" chunkedEnc=1 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"                 -0.62 %            0.56114697
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"       -1.26 %            0.61128923
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"         0.12 %            0.87525713
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"         -1.86 %            0.38071298
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"           1.33 %            0.46763187
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"             0.21 %            0.91503631
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"             -1.13 %            0.56201708
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"       -1.18 %            0.53024187
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"         2.54 %            0.21866379
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"         -1.51 %            0.44929541
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"           2.02 %            0.29231908
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"             1.09 %            0.60320018
 http/simple.js res="setHeader" chunkedEnc=0 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"              0.03 %            0.98536286
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"        -2.82 %            0.21218297
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"          1.74 %            0.08933943
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"           0.58 %            0.64758942
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"            0.97 %            0.42155372
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"              0.42 %            0.74674388
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"              -1.40 %            0.28145725
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"        -0.16 %            0.93735811
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"         -2.62 %          * 0.01006396
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"           2.11 %            0.17754535
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"            0.59 %            0.68238131
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"             -0.58 %            0.71105704
 http/simple.js res="setHeader" chunkedEnc=0 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"               0.02 %            0.98664196
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"       -2.59 %            0.24601602
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"         1.82 %            0.35081491
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"          1.65 %            0.37117810
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"          -1.61 %            0.45060051
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"            -1.06 %            0.56844539
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"             -0.96 %            0.65711844
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"        0.58 %            0.78319414
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"         4.36 %          * 0.03827254
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"         -0.55 %            0.79480444
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"          -0.55 %            0.81835328
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"            -0.37 %            0.88706904
 http/simple.js res="setHeader" chunkedEnc=1 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"             -0.45 %            0.85948312
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"        -1.63 %            0.43661370
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"          1.92 %            0.30403135
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"           1.30 %            0.39990253
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"            0.16 %            0.90686720
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"             -0.43 %            0.77537700
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"              -0.62 %            0.70286068
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"        -2.55 %            0.19109423
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"         -0.35 %            0.82464616
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"           1.06 %            0.41076017
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"            0.27 %            0.81473136
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"              1.11 %            0.36410566
 http/simple.js res="setHeader" chunkedEnc=1 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"              -1.23 %            0.36800337
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"     -0.27 %            0.90833367
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"       0.31 %            0.62606562
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"       -1.78 %            0.34433387
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"        -4.60 %          * 0.01909328
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"           2.00 %            0.32293420
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"            0.07 %            0.96895031
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"     -0.79 %            0.69429809
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"      -1.38 %            0.52832827
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"        0.01 %            0.99663378
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"        -1.23 %            0.54913202
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"           0.11 %            0.95649993
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"           -0.30 %            0.89002003
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"       0.19 %            0.92471396
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"       -0.95 %            0.28243322
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"        -0.36 %            0.80717212
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"          1.46 %            0.25002692
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"            0.84 %            0.51277492
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"            -1.23 %            0.33675352
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"       0.83 %            0.70707835
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"       -1.81 %            0.05632670
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"        -2.06 %            0.18310387
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"         -1.59 %            0.24695620
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"           -0.29 %            0.84704512
 http/simple.js res="setHeaderWH" chunkedEnc=0 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"             1.91 %            0.16107561
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=102400 type="buffer" benchmarker="wrk"      2.79 %            0.18543554
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=102400 type="bytes" benchmarker="wrk"      -1.87 %            0.30148374
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=1024 type="buffer" benchmarker="wrk"       -0.44 %            0.80841542
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=1024 type="bytes" benchmarker="wrk"        -5.49 %          * 0.01021839
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=4 type="buffer" benchmarker="wrk"           3.28 %            0.10063067
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=1 len=4 type="bytes" benchmarker="wrk"            0.41 %            0.85708772
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=102400 type="buffer" benchmarker="wrk"      1.34 %            0.51300429
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=102400 type="bytes" benchmarker="wrk"      -0.17 %            0.94332052
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=1024 type="buffer" benchmarker="wrk"        0.08 %            0.96705513
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=1024 type="bytes" benchmarker="wrk"         1.15 %            0.60746544
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=4 type="buffer" benchmarker="wrk"          -1.29 %            0.60867535
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=500 chunks=4 len=4 type="bytes" benchmarker="wrk"            2.02 %            0.38739628
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk"       2.33 %            0.25381035
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=102400 type="bytes" benchmarker="wrk"        0.84 %            0.65268523
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk"         1.39 %            0.26676284
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=1024 type="bytes" benchmarker="wrk"          1.46 %            0.21578340
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=4 type="buffer" benchmarker="wrk"            1.12 %            0.47236835
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=1 len=4 type="bytes" benchmarker="wrk"            -1.31 %            0.43106352
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk"      -0.65 %            0.72103296
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=102400 type="bytes" benchmarker="wrk"       -1.22 %            0.43091204
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk"         1.60 %            0.25180900
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=1024 type="bytes" benchmarker="wrk"         -0.30 %            0.79596835
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=4 type="buffer" benchmarker="wrk"           -0.03 %            0.98326458
 http/simple.js res="setHeaderWH" chunkedEnc=1 c=50 chunks=4 len=4 type="bytes" benchmarker="wrk"             0.52 %            0.65202012

@AndreasMadsen
Copy link
Member Author

Landed in 8479606

@AndreasMadsen
Copy link
Member Author

I think this will solve the issue: #18143

if not, we should revert this.

apapirovski pushed a commit that referenced this pull request Jan 14, 2018
If IPv6 is not supported on a machine, the IPv6 handle will first be
created, this will then fail and default to an IPv4 handle. This causes
the graph to change, as there now is an extra handle.

PR-URL: #18143
Fixes: #18003
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
gibfahn pushed a commit to gibfahn/node that referenced this pull request Jan 17, 2018
This allows more easy tracking of where HTTP requests come from. Before
this change the HTTPParser would have the HTTPServer as the
triggerAsyncId.

The HTTPParser will still have the executionAsyncId set to the HTTP
Server so that information is still directly available. Indirectly, the
TCP socket itself also has its triggerAsyncId set to the TCP Server.

PR-URL: nodejs#18003
Backport-PR-URL: nodejs#18179
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
gibfahn pushed a commit to gibfahn/node that referenced this pull request Jan 17, 2018
If IPv6 is not supported on a machine, the IPv6 handle will first be
created, this will then fail and default to an IPv4 handle. This causes
the graph to change, as there now is an extra handle.

PR-URL: nodejs#18143
Backport-PR-URL: nodejs#18179
Fixes: nodejs#18003
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 19, 2018
This allows more easy tracking of where HTTP requests come from. Before
this change the HTTPParser would have the HTTPServer as the
triggerAsyncId.

The HTTPParser will still have the executionAsyncId set to the HTTP
Server so that information is still directly available. Indirectly, the
TCP socket itself also has its triggerAsyncId set to the TCP Server.

Backport-PR-URL: #18179
PR-URL: #18003
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 19, 2018
If IPv6 is not supported on a machine, the IPv6 handle will first be
created, this will then fail and default to an IPv4 handle. This causes
the graph to change, as there now is an extra handle.

Backport-PR-URL: #18179
PR-URL: #18143
Fixes: #18003
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@evanlucas
Copy link
Contributor

Although this lands cleanly on v9.x-staging, the tests fail. If you would like to see it land in v9.x, can you please submit a backport PR? Thanks!

@AndreasMadsen
Copy link
Member Author

AndreasMadsen commented Jan 30, 2018

@evanlucas You need to apply some other commits, then everything works: #18143

@AndreasMadsen
Copy link
Member Author

AndreasMadsen commented Jan 31, 2018

@evanlucas Sorry, wrong PR. I have done the full "backport" (no changes) #18474

evanlucas pushed a commit that referenced this pull request Jan 31, 2018
This allows more easy tracking of where HTTP requests come from. Before
this change the HTTPParser would have the HTTPServer as the
triggerAsyncId.

The HTTPParser will still have the executionAsyncId set to the HTTP
Server so that information is still directly available. Indirectly, the
TCP socket itself also has its triggerAsyncId set to the TCP Server.

Backport-PR-URL: #18474
PR-URL: #18003
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
evanlucas pushed a commit that referenced this pull request Jan 31, 2018
If IPv6 is not supported on a machine, the IPv6 handle will first be
created, this will then fail and default to an IPv4 handle. This causes
the graph to change, as there now is an extra handle.

Backport-PR-URL: #18474
PR-URL: #18143
Fixes: #18003
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
gibfahn added a commit that referenced this pull request Mar 6, 2018
Notable changes:

* deps:
  * update V8 to 6.2.414.46 (Michaël Zasso) [#16413](#16413)
  * revert ABI breaking changes in V8 6.2 (Anna Henningsen) [#16413](#16413)
  * upgrade libuv to 1.19.1 (cjihrig) [#18260](#18260)
  * re land npm 5.6.0 (Myles Borins) [#18625](#18625)
  * ICU 60 bump (Steven R. Loomis) [#16876](#16876)
* crypto:
  * Support both OpenSSL 1.1.0 and 1.0.2 (David Benjamin) [#16130](#16130)
  * warn on invalid authentication tag length (Tobias Nießen) [#17566](#17566)
* async_hooks:
  * update defaultTriggerAsyncIdScope for perf (Anatoli Papirovski) [#18004](#18004)
  * use typed array stack as fast path (Anna Henningsen) [#17780](#17780)
  * use scope for defaultTriggerAsyncId (Andreas Madsen) [#17273](#17273)
  * separate missing from default context (Andreas Madsen) [#17273](#17273)
  * rename initTriggerId (Andreas Madsen) [#17273](#17273)
  * deprecate undocumented API (Andreas Madsen) [#16972](#16972)
  * add destroy event for gced AsyncResources (Sebastian Mayr) [#16998](#16998)
  * add trace events to async_hooks (Andreas Madsen) [#15538](#15538)
  * set HTTPParser trigger to socket (Andreas Madsen) [#18003](#18003)
  * add provider types for net server (Andreas Madsen) [#17157](#17157)
* n-api:
  * add helper for addons to get the event loop (Anna Henningsen) [#17109](#17109)
* cli:
  * add --stack-trace-limit to NODE_OPTIONS (Anna Henningsen) [#16495](#16495)
* console:
  * add support for console.debug (Benjamin Zaslavsky) [#17033](#17033)
* module:
  * add builtinModules (Jon Moss) [#16386](#16386)
  * replace default paths in require.resolve() (cjihrig) [#17113](#17113)
* src:
  * add helper for addons to get the event loop (Anna Henningsen) [#17109](#17109)
  * add process.ppid (cjihrig) [#16839](#16839)
* http:
  * support generic `Duplex` streams (Anna Henningsen) [#16267](#16267)
  * add rawPacket in err of `clientError` event (XadillaX) [#17672](#17672)
  * better support for IPv6 addresses (Mattias Holmlund) [#14772](#14772)
* net:
  * remove ADDRCONFIG DNS hint on Windows (Bartosz Sosnowski) [#17662](#17662)
* process:
  * fix reading zero-length env vars on win32 (Anna Henningsen) [#18463](#18463)
* tls:
  * unconsume stream on destroy (Anna Henningsen) [#17478](#17478)
* process:
  * improve unhandled rejection message (Madara Uchiha) [#17158](#17158)
* stream:
  * remove usage of *State.highWaterMark (Calvin Metcalf) [#12860](#12860)
* trace_events:
  * add executionAsyncId to init events (Andreas Madsen) [#17196](#17196)

PR-URL: #18336
gibfahn added a commit that referenced this pull request Mar 7, 2018
Notable changes:

* deps:
  * update V8 to 6.2.414.46 (Michaël Zasso) [#16413](#16413)
  * revert ABI breaking changes in V8 6.2 (Anna Henningsen) [#16413](#16413)
  * upgrade libuv to 1.19.1 (cjihrig) [#18260](#18260)
  * re land npm 5.6.0 (Myles Borins) [#18625](#18625)
  * ICU 60 bump (Steven R. Loomis) [#16876](#16876)
* crypto:
  * Support both OpenSSL 1.1.0 and 1.0.2 (David Benjamin) [#16130](#16130)
  * warn on invalid authentication tag length (Tobias Nießen) [#17566](#17566)
* async_hooks:
  * update defaultTriggerAsyncIdScope for perf (Anatoli Papirovski) [#18004](#18004)
  * use typed array stack as fast path (Anna Henningsen) [#17780](#17780)
  * use scope for defaultTriggerAsyncId (Andreas Madsen) [#17273](#17273)
  * separate missing from default context (Andreas Madsen) [#17273](#17273)
  * rename initTriggerId (Andreas Madsen) [#17273](#17273)
  * deprecate undocumented API (Andreas Madsen) [#16972](#16972)
  * add destroy event for gced AsyncResources (Sebastian Mayr) [#16998](#16998)
  * add trace events to async_hooks (Andreas Madsen) [#15538](#15538)
  * set HTTPParser trigger to socket (Andreas Madsen) [#18003](#18003)
  * add provider types for net server (Andreas Madsen) [#17157](#17157)
* n-api:
  * add helper for addons to get the event loop (Anna Henningsen) [#17109](#17109)
* cli:
  * add --stack-trace-limit to NODE_OPTIONS (Anna Henningsen) [#16495](#16495)
* console:
  * add support for console.debug (Benjamin Zaslavsky) [#17033](#17033)
* module:
  * add builtinModules (Jon Moss) [#16386](#16386)
  * replace default paths in require.resolve() (cjihrig) [#17113](#17113)
* src:
  * add helper for addons to get the event loop (Anna Henningsen) [#17109](#17109)
  * add process.ppid (cjihrig) [#16839](#16839)
* http:
  * support generic `Duplex` streams (Anna Henningsen) [#16267](#16267)
  * add rawPacket in err of `clientError` event (XadillaX) [#17672](#17672)
  * better support for IPv6 addresses (Mattias Holmlund) [#14772](#14772)
* net:
  * remove ADDRCONFIG DNS hint on Windows (Bartosz Sosnowski) [#17662](#17662)
* process:
  * fix reading zero-length env vars on win32 (Anna Henningsen) [#18463](#18463)
* tls:
  * unconsume stream on destroy (Anna Henningsen) [#17478](#17478)
* process:
  * improve unhandled rejection message (Madara Uchiha) [#17158](#17158)
* stream:
  * remove usage of *State.highWaterMark (Calvin Metcalf) [#12860](#12860)
* trace_events:
  * add executionAsyncId to init events (Andreas Madsen) [#17196](#17196)

PR-URL: #18336
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
Notable changes:

* deps:
  * update V8 to 6.2.414.46 (Michaël Zasso) [nodejs#16413](nodejs#16413)
  * revert ABI breaking changes in V8 6.2 (Anna Henningsen) [nodejs#16413](nodejs#16413)
  * upgrade libuv to 1.19.1 (cjihrig) [nodejs#18260](nodejs#18260)
  * re land npm 5.6.0 (Myles Borins) [nodejs#18625](nodejs#18625)
  * ICU 60 bump (Steven R. Loomis) [nodejs#16876](nodejs#16876)
* crypto:
  * Support both OpenSSL 1.1.0 and 1.0.2 (David Benjamin) [nodejs#16130](nodejs#16130)
  * warn on invalid authentication tag length (Tobias Nießen) [nodejs#17566](nodejs#17566)
* async_hooks:
  * update defaultTriggerAsyncIdScope for perf (Anatoli Papirovski) [nodejs#18004](nodejs#18004)
  * use typed array stack as fast path (Anna Henningsen) [nodejs#17780](nodejs#17780)
  * use scope for defaultTriggerAsyncId (Andreas Madsen) [nodejs#17273](nodejs#17273)
  * separate missing from default context (Andreas Madsen) [nodejs#17273](nodejs#17273)
  * rename initTriggerId (Andreas Madsen) [nodejs#17273](nodejs#17273)
  * deprecate undocumented API (Andreas Madsen) [nodejs#16972](nodejs#16972)
  * add destroy event for gced AsyncResources (Sebastian Mayr) [nodejs#16998](nodejs#16998)
  * add trace events to async_hooks (Andreas Madsen) [nodejs#15538](nodejs#15538)
  * set HTTPParser trigger to socket (Andreas Madsen) [nodejs#18003](nodejs#18003)
  * add provider types for net server (Andreas Madsen) [nodejs#17157](nodejs#17157)
* n-api:
  * add helper for addons to get the event loop (Anna Henningsen) [nodejs#17109](nodejs#17109)
* cli:
  * add --stack-trace-limit to NODE_OPTIONS (Anna Henningsen) [nodejs#16495](nodejs#16495)
* console:
  * add support for console.debug (Benjamin Zaslavsky) [nodejs#17033](nodejs#17033)
* module:
  * add builtinModules (Jon Moss) [nodejs#16386](nodejs#16386)
  * replace default paths in require.resolve() (cjihrig) [nodejs#17113](nodejs#17113)
* src:
  * add helper for addons to get the event loop (Anna Henningsen) [nodejs#17109](nodejs#17109)
  * add process.ppid (cjihrig) [nodejs#16839](nodejs#16839)
* http:
  * support generic `Duplex` streams (Anna Henningsen) [nodejs#16267](nodejs#16267)
  * add rawPacket in err of `clientError` event (XadillaX) [nodejs#17672](nodejs#17672)
  * better support for IPv6 addresses (Mattias Holmlund) [nodejs#14772](nodejs#14772)
* net:
  * remove ADDRCONFIG DNS hint on Windows (Bartosz Sosnowski) [nodejs#17662](nodejs#17662)
* process:
  * fix reading zero-length env vars on win32 (Anna Henningsen) [nodejs#18463](nodejs#18463)
* tls:
  * unconsume stream on destroy (Anna Henningsen) [nodejs#17478](nodejs#17478)
* process:
  * improve unhandled rejection message (Madara Uchiha) [nodejs#17158](nodejs#17158)
* stream:
  * remove usage of *State.highWaterMark (Calvin Metcalf) [nodejs#12860](nodejs#12860)
* trace_events:
  * add executionAsyncId to init events (Andreas Madsen) [nodejs#17196](nodejs#17196)

PR-URL: nodejs#18336
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async_hooks Issues and PRs related to the async hooks subsystem. http Issues or PRs related to the http subsystem. lib / src Issues and PRs related to general changes in the lib or src directory. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.