diff options
author | Diego Lafuente <diego.lafuente@logtrust.com> | 2019-05-30 12:40:08 +0300 |
---|---|---|
committer | Gireesh Punathil <gpunathi@in.ibm.com> | 2019-12-20 11:19:15 +0300 |
commit | fc553fd8213f81267d5bec76a9f9d9db1cda52a9 (patch) | |
tree | 0e629dec3c75cb87566d1102327298cd5dc39ec1 /benchmark/tls/secure-pair.js | |
parent | 9e6c2ba68a46ee693cf0b4875966f96a6dc261cf (diff) |
benchmark: add clear connections to secure-pair
adds clear connections to the secure-pair performance test to prove
that in some cases (when the sender send the data in small chunks)
clear connections perform worse than TLS connections
Also add a byte chunk size test to benchmark/net/net-pipe.js
Refs: https://github.com/nodejs/node/issues/27970
PR-URL: https://github.com/nodejs/node/pull/27971
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'benchmark/tls/secure-pair.js')
-rw-r--r-- | benchmark/tls/secure-pair.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/benchmark/tls/secure-pair.js b/benchmark/tls/secure-pair.js index c0409febacd..c52f4cbf918 100644 --- a/benchmark/tls/secure-pair.js +++ b/benchmark/tls/secure-pair.js @@ -2,8 +2,8 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { dur: [5], - securing: ['SecurePair', 'TLSSocket'], - size: [2, 1024, 1024 * 1024] + securing: ['SecurePair', 'TLSSocket', 'clear'], + size: [2, 100, 1024, 1024 * 1024] }); const fixtures = require('../../test/common/fixtures'); @@ -37,7 +37,8 @@ function main({ dur, size, securing }) { isServer: false, rejectUnauthorized: false, }; - const conn = tls.connect(clientOptions, () => { + const network = securing === 'clear' ? net : tls; + const conn = network.connect(clientOptions, () => { setTimeout(() => { const mbits = (received * 8) / (1024 * 1024); bench.end(mbits); @@ -69,6 +70,9 @@ function main({ dur, size, securing }) { case 'TLSSocket': secureTLSSocket(conn, client); break; + case 'clear': + conn.pipe(client); + break; default: throw new Error('Invalid securing method'); } |