From 509bf09b8357b88503fa5fd1c74fc9744b4def9a Mon Sep 17 00:00:00 2001 From: Diego Lafuente Date: Thu, 30 May 2019 11:40:08 +0200 Subject: [PATCH 1/2] benchmark: added clear connections to secure-pair performance test adds clear connections to the secure-pair performance test to prove thah in some cases (when the sender send the data in small chunks) clear connections perform worse than TLS connections Refs: https://github.com/nodejs/node/issues/27970 --- benchmark/tls/secure-pair.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/benchmark/tls/secure-pair.js b/benchmark/tls/secure-pair.js index ed678b9060983e..f3050bed664205 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 fs = require('fs'); @@ -39,7 +39,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); @@ -71,6 +72,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'); } From 809ee8cf9facce1f2d2978384f210d76d2082bf7 Mon Sep 17 00:00:00 2001 From: Diego Lafuente Date: Thu, 30 May 2019 14:55:11 +0200 Subject: [PATCH 2/2] benchmark: added a byte chunk size test to benchmark/net/net-pipe.js --- benchmark/net/net-pipe.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/net/net-pipe.js b/benchmark/net/net-pipe.js index c4e1da3f6f0c8b..540660309fc6d9 100644 --- a/benchmark/net/net-pipe.js +++ b/benchmark/net/net-pipe.js @@ -6,7 +6,7 @@ const net = require('net'); const PORT = common.PORT; const bench = common.createBenchmark(main, { - len: [64, 102400, 1024 * 1024 * 16], + len: [2, 64, 102400, 1024 * 1024 * 16], type: ['utf', 'asc', 'buf'], dur: [5], });