mirror of https://github.com/nodejs/node.git
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>
This commit is contained in:
parent
053abac02b
commit
1c4fa9a48a
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
});
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue