-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport-PR-URL: #14813 Backport-Reviewed-By: Anna Henningsen <[email protected]> Backport-Reviewed-By: Timothy Gu <[email protected]> PR-URL: #14239 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
- Loading branch information
Showing
95 changed files
with
5,327 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict'; | ||
|
||
const common = require('../common.js'); | ||
const PORT = common.PORT; | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html'); | ||
|
||
var bench = common.createBenchmark(main, { | ||
requests: [100, 1000, 10000, 100000, 1000000], | ||
streams: [100, 200, 1000], | ||
clients: [1, 2] | ||
}, { flags: ['--expose-http2', '--no-warnings'] }); | ||
|
||
function main(conf) { | ||
|
||
fs.open(file, 'r', (err, fd) => { | ||
if (err) | ||
throw err; | ||
|
||
const n = +conf.requests; | ||
const m = +conf.streams; | ||
const c = +conf.clients; | ||
const http2 = require('http2'); | ||
const server = http2.createServer(); | ||
server.on('stream', (stream) => { | ||
stream.respondWithFD(fd); | ||
stream.on('error', (err) => {}); | ||
}); | ||
server.listen(PORT, () => { | ||
bench.http({ | ||
path: '/', | ||
requests: n, | ||
maxConcurrentStreams: m, | ||
clients: c, | ||
threads: c | ||
}, () => server.close()); | ||
}); | ||
|
||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
|
||
const common = require('../common.js'); | ||
const PORT = common.PORT; | ||
|
||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html'); | ||
|
||
var bench = common.createBenchmark(main, { | ||
requests: [100, 1000, 10000, 100000], | ||
streams: [100, 200, 1000], | ||
clients: [1, 2] | ||
}, { flags: ['--expose-http2', '--no-warnings'] }); | ||
|
||
function main(conf) { | ||
const n = +conf.requests; | ||
const m = +conf.streams; | ||
const c = +conf.clients; | ||
const http2 = require('http2'); | ||
const server = http2.createServer(); | ||
server.on('stream', (stream) => { | ||
const out = fs.createReadStream(file); | ||
stream.respond(); | ||
out.pipe(stream); | ||
stream.on('error', (err) => {}); | ||
}); | ||
server.listen(PORT, () => { | ||
bench.http({ | ||
path: '/', | ||
requests: n, | ||
maxConcurrentStreams: m, | ||
clients: c, | ||
threads: c | ||
}, () => { server.close(); }); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.