diff options
Diffstat (limited to 'deps/node/benchmark/http2')
-rw-r--r-- | deps/node/benchmark/http2/compat.js | 35 | ||||
-rw-r--r-- | deps/node/benchmark/http2/headers.js | 57 | ||||
-rw-r--r-- | deps/node/benchmark/http2/respond-with-fd.js | 39 | ||||
-rw-r--r-- | deps/node/benchmark/http2/simple.js | 33 | ||||
-rw-r--r-- | deps/node/benchmark/http2/write.js | 35 |
5 files changed, 0 insertions, 199 deletions
diff --git a/deps/node/benchmark/http2/compat.js b/deps/node/benchmark/http2/compat.js deleted file mode 100644 index 5d06ccf3..00000000 --- a/deps/node/benchmark/http2/compat.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -const common = require('../common.js'); -const path = require('path'); -const fs = require('fs'); -const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html'); - -const bench = common.createBenchmark(main, { - requests: [100, 1000, 5000], - streams: [1, 10, 20, 40, 100, 200], - clients: [2], - benchmarker: ['h2load'] -}, { flags: ['--no-warnings'] }); - -function main({ requests, streams, clients }) { - const http2 = require('http2'); - const server = http2.createServer(); - server.on('request', (req, res) => { - const out = fs.createReadStream(file); - res.setHeader('content-type', 'text/html'); - out.pipe(res); - out.on('error', (err) => { - res.destroy(); - }); - }); - server.listen(common.PORT, () => { - bench.http({ - path: '/', - requests, - maxConcurrentStreams: streams, - clients, - threads: clients - }, () => { server.close(); }); - }); -} diff --git a/deps/node/benchmark/http2/headers.js b/deps/node/benchmark/http2/headers.js deleted file mode 100644 index f18a73b9..00000000 --- a/deps/node/benchmark/http2/headers.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; - -const common = require('../common.js'); -const PORT = common.PORT; - -const bench = common.createBenchmark(main, { - n: [1e3], - nheaders: [0, 10, 100, 1000] -}, { flags: ['--no-warnings'] }); - -function main({ n, nheaders }) { - const http2 = require('http2'); - const server = http2.createServer({ - maxHeaderListPairs: 20000 - }); - - const headersObject = { - ':path': '/', - ':scheme': 'http', - 'accept-encoding': 'gzip, deflate', - 'accept-language': 'en', - 'content-type': 'text/plain', - 'referer': 'https://example.org/', - 'user-agent': 'SuperBenchmarker 3000' - }; - - for (var i = 0; i < nheaders; i++) { - headersObject[`foo${i}`] = `some header value ${i}`; - } - - server.on('stream', (stream) => { - stream.respond(); - stream.end('Hi!'); - }); - server.listen(PORT, () => { - const client = http2.connect(`http://localhost:${PORT}/`, { - maxHeaderListPairs: 20000 - }); - - function doRequest(remaining) { - const req = client.request(headersObject); - req.resume(); - req.on('end', () => { - if (remaining > 0) { - doRequest(remaining - 1); - } else { - bench.end(n); - server.close(); - client.destroy(); - } - }); - } - - bench.start(); - doRequest(n); - }); -} diff --git a/deps/node/benchmark/http2/respond-with-fd.js b/deps/node/benchmark/http2/respond-with-fd.js deleted file mode 100644 index 35856490..00000000 --- a/deps/node/benchmark/http2/respond-with-fd.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -const common = require('../common.js'); -const path = require('path'); -const fs = require('fs'); - -const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html'); - -const bench = common.createBenchmark(main, { - requests: [100, 1000, 5000], - streams: [1, 10, 20, 40, 100, 200], - clients: [2], - benchmarker: ['h2load'] -}, { flags: ['--no-warnings'] }); - -function main({ requests, streams, clients }) { - fs.open(file, 'r', (err, fd) => { - if (err) - throw err; - - const http2 = require('http2'); - const server = http2.createServer(); - server.on('stream', (stream) => { - stream.respondWithFD(fd); - stream.on('error', (err) => {}); - }); - server.listen(common.PORT, () => { - bench.http({ - path: '/', - requests, - maxConcurrentStreams: streams, - clients, - threads: clients - }, () => server.close()); - }); - - }); - -} diff --git a/deps/node/benchmark/http2/simple.js b/deps/node/benchmark/http2/simple.js deleted file mode 100644 index aab7c6b6..00000000 --- a/deps/node/benchmark/http2/simple.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -const common = require('../common.js'); -const path = require('path'); -const fs = require('fs'); -const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html'); - -const bench = common.createBenchmark(main, { - requests: [100, 1000, 5000], - streams: [1, 10, 20, 40, 100, 200], - clients: [2], - benchmarker: ['h2load'] -}, { flags: ['--no-warnings'] }); - -function main({ requests, streams, 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(common.PORT, () => { - bench.http({ - path: '/', - requests, - maxConcurrentStreams: streams, - clients, - threads: clients - }, () => { server.close(); }); - }); -} diff --git a/deps/node/benchmark/http2/write.js b/deps/node/benchmark/http2/write.js deleted file mode 100644 index fc3203c6..00000000 --- a/deps/node/benchmark/http2/write.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -const common = require('../common.js'); - -const bench = common.createBenchmark(main, { - streams: [100, 200, 1000], - length: [64 * 1024, 128 * 1024, 256 * 1024, 1024 * 1024], - size: [100000], - benchmarker: ['h2load'] -}, { flags: ['--no-warnings'] }); - -function main({ streams, length, size }) { - const http2 = require('http2'); - const server = http2.createServer(); - server.on('stream', (stream) => { - stream.respond(); - let written = 0; - function write() { - stream.write('ΓΌ'.repeat(size)); - written += size; - if (written < length) - setImmediate(write); - else - stream.end(); - } - write(); - }); - server.listen(common.PORT, () => { - bench.http({ - path: '/', - requests: 10000, - maxConcurrentStreams: streams, - }, () => { server.close(); }); - }); -} |