Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2021-01-10 20:08:35 +0300
committerRich Trott <rtrott@gmail.com>2021-01-11 07:26:54 +0300
commit1c4fa9a48ab08627475e3988483c18d946e81d80 (patch)
treeb1feb965786ba726c9ff9491d6a3b2561d924573 /benchmark
parent053abac02bafafa89824613192a2c7d22950bb01 (diff)
benchmark: fix http2 benchmarks
Fixes: https://github.com/nodejs/node/issues/36746 PR-URL: https://github.com/nodejs/node/pull/36871 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/_test-double-benchmarker.js2
-rw-r--r--benchmark/http2/compat.js3
-rw-r--r--benchmark/http2/headers.js5
-rw-r--r--benchmark/http2/respond-with-fd.js3
-rw-r--r--benchmark/http2/simple.js3
-rw-r--r--benchmark/http2/write.js3
6 files changed, 11 insertions, 8 deletions
diff --git a/benchmark/_test-double-benchmarker.js b/benchmark/_test-double-benchmarker.js
index 89843d4616c..2d05f9fd92b 100644
--- a/benchmark/_test-double-benchmarker.js
+++ b/benchmark/_test-double-benchmarker.js
@@ -46,7 +46,7 @@ function run() {
}
} else { // HTTP/2
const client = http.connect(url);
- client.on('error', (e) => { throw e; });
+ client.on('error', () => {});
request(client.request(), client);
}
}
diff --git a/benchmark/http2/compat.js b/benchmark/http2/compat.js
index 2c7e732b07f..9ca7ab1ba08 100644
--- a/benchmark/http2/compat.js
+++ b/benchmark/http2/compat.js
@@ -24,9 +24,10 @@ function main({ requests, streams, clients, duration }) {
res.destroy();
});
});
- server.listen(common.PORT, () => {
+ server.listen(0, () => {
bench.http({
path: '/',
+ port: server.address().port,
requests,
maxConcurrentStreams: streams,
clients,
diff --git a/benchmark/http2/headers.js b/benchmark/http2/headers.js
index 56799da1987..886f64be1c8 100644
--- a/benchmark/http2/headers.js
+++ b/benchmark/http2/headers.js
@@ -1,7 +1,6 @@
'use strict';
const common = require('../common.js');
-const PORT = common.PORT;
const bench = common.createBenchmark(main, {
n: [1e3],
@@ -32,8 +31,8 @@ function main({ n, nheaders }) {
stream.respond();
stream.end('Hi!');
});
- server.listen(PORT, () => {
- const client = http2.connect(`http://localhost:${PORT}/`, {
+ server.listen(0, () => {
+ const client = http2.connect(`http://localhost:${server.address().port}/`, {
maxHeaderListPairs: 20000
});
diff --git a/benchmark/http2/respond-with-fd.js b/benchmark/http2/respond-with-fd.js
index 5bf5988d16a..547b6900b61 100644
--- a/benchmark/http2/respond-with-fd.js
+++ b/benchmark/http2/respond-with-fd.js
@@ -25,10 +25,11 @@ function main({ requests, streams, clients, duration }) {
stream.respondWithFD(fd);
stream.on('error', (err) => {});
});
- server.listen(common.PORT, () => {
+ server.listen(0, () => {
bench.http({
path: '/',
requests,
+ port: server.address().port,
maxConcurrentStreams: streams,
clients,
duration,
diff --git a/benchmark/http2/simple.js b/benchmark/http2/simple.js
index 929c4c655e1..d9ac513d3c3 100644
--- a/benchmark/http2/simple.js
+++ b/benchmark/http2/simple.js
@@ -22,9 +22,10 @@ function main({ requests, streams, clients, duration }) {
out.pipe(stream);
stream.on('error', (err) => {});
});
- server.listen(common.PORT, () => {
+ server.listen(0, () => {
bench.http({
path: '/',
+ port: server.address().port,
requests,
maxConcurrentStreams: streams,
clients,
diff --git a/benchmark/http2/write.js b/benchmark/http2/write.js
index 7ea8b2c02da..caf93e2f2b6 100644
--- a/benchmark/http2/write.js
+++ b/benchmark/http2/write.js
@@ -26,9 +26,10 @@ function main({ streams, length, size, duration }) {
}
write();
});
- server.listen(common.PORT, () => {
+ server.listen(0, () => {
bench.http({
path: '/',
+ port: server.address().port,
requests: 10000,
duration,
maxConcurrentStreams: streams,