Skip to content

Commit

Permalink
Increase throughput by 256x
Browse files Browse the repository at this point in the history
Example latency: 20ms
Session: 6400MB/s
Stream: 800MB/s

Example latency: 250ms
Session: 512MB/s
Stream: 64MB/s
  • Loading branch information
szmarczak committed Apr 27, 2021
1 parent 72297e2 commit 3ff05e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ class Agent extends EventEmitter {

// We don't support push streams by default.
this.settings = {
enablePush: false
enablePush: false,
initialWindowSize: 1024 * 1024 * 128 // 128MB, see /~https://github.com/nodejs/node/issues/38426
};

// Reusing TLS sessions increases performance.
Expand Down Expand Up @@ -530,6 +531,9 @@ class Agent extends EventEmitter {
return;
}

// See /~https://github.com/nodejs/node/issues/38426
session.setLocalWindowSize(1024 * 1024 * 16); // 16 MB

session[kOriginSet] = session.originSet || [];

if (session.socket.encrypted) {
Expand Down

0 comments on commit 3ff05e9

Please sign in to comment.