diff --git a/doc/api/http2.md b/doc/api/http2.md
index 62a213f145d80e..fb41e4dddfc2b3 100644
--- a/doc/api/http2.md
+++ b/doc/api/http2.md
@@ -3544,10 +3544,10 @@ properties.
permitted on the `Http2Session` instances. **Default:** `true`.
* `initialWindowSize` {number} Specifies the _sender's_ initial window size in
bytes for stream-level flow control. The minimum allowed value is 0. The
- maximum allowed value is 232-1. **Default:** `65535`.
+ maximum allowed value is 232-1. **Default:** `262144`.
* `maxFrameSize` {number} Specifies the size in bytes of the largest frame
payload. The minimum allowed value is 16,384. The maximum allowed value is
- 224-1. **Default:** `16384`.
+ 224-1. **Default:** `32768`.
* `maxConcurrentStreams` {number} Specifies the maximum number of concurrent
streams permitted on an `Http2Session`. There is no default value which
implies, at least theoretically, 232-1 streams may be open
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js
index 4a47b77dc84075..4129e6eb1c55f3 100644
--- a/lib/internal/http2/core.js
+++ b/lib/internal/http2/core.js
@@ -3302,6 +3302,10 @@ function connectionListener(socket) {
socket[kServer] = this;
+ // NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE default is 64KB, but we want to allow more data to be
+ // buffered without applying backpressure.
+ session.setLocalWindowSize(512 * 1024);
+
this.emit('session', session);
}
@@ -3309,7 +3313,7 @@ function initializeOptions(options) {
assertIsObject(options, 'options');
options = { ...options };
assertIsObject(options.settings, 'options.settings');
- options.settings = { ...options.settings };
+ options.settings = { ...getDefaultSettings(), ...options.settings };
assertIsArray(options.remoteCustomSettings, 'options.remoteCustomSettings');
if (options.remoteCustomSettings) {
@@ -3531,6 +3535,8 @@ function connect(authority, options, listener) {
assertIsObject(options, 'options');
options = { ...options };
+ assertIsObject(options.settings, 'options.settings');
+ options.settings = { ...getDefaultSettings(), ...options.settings };
assertIsArray(options.remoteCustomSettings, 'options.remoteCustomSettings');
if (options.remoteCustomSettings) {
@@ -3576,6 +3582,10 @@ function connect(authority, options, listener) {
const session = new ClientHttp2Session(options, socket);
+ // NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE default is 64KB, but we want to allow more data to be
+ // buffered without applying backpressure.
+ session.setLocalWindowSize(512 * 1024);
+
session[kAuthority] = `${options.servername || host}:${port}`;
session[kProtocol] = protocol;
diff --git a/lib/internal/http2/util.js b/lib/internal/http2/util.js
index ba981c8934dee9..7750a1d00e2123 100644
--- a/lib/internal/http2/util.js
+++ b/lib/internal/http2/util.js
@@ -364,6 +364,13 @@ function getDefaultSettings() {
settingsBuffer[IDX_SETTINGS_ENABLE_CONNECT_PROTOCOL] === 1;
}
+ // NGHTTP2_INITIAL_WINDOW_SIZE default is 64KB, but we want to allow more data to be
+ // buffered without applying backpressure.
+ holder.initialWindowSize = MathMax(holder.initialWindowSize, 256 * 1024);
+
+ // Default is 16KB.
+ holder.maxFrameSize = MathMax(32 * 1024, holder.maxFrameSize);
+
if (settingsBuffer[IDX_SETTINGS_FLAGS + 1]) holder.customSettings = addCustomSettingsToObj();
return holder;
diff --git a/test/parallel/test-http2-binding.js b/test/parallel/test-http2-binding.js
index 7a91b2ba7406cd..ed713cdc011fec 100644
--- a/test/parallel/test-http2-binding.js
+++ b/test/parallel/test-http2-binding.js
@@ -17,8 +17,8 @@ const settings = http2.getDefaultSettings();
assert.strictEqual(settings.headerTableSize, 4096);
assert.strictEqual(settings.enablePush, true);
assert.strictEqual(settings.maxConcurrentStreams, 4294967295);
-assert.strictEqual(settings.initialWindowSize, 65535);
-assert.strictEqual(settings.maxFrameSize, 16384);
+assert.strictEqual(settings.initialWindowSize, 256 * 1024);
+assert.strictEqual(settings.maxFrameSize, 32 * 1024);
assert.strictEqual(binding.nghttp2ErrorString(-517),
'GOAWAY has already been sent');