Skip to content

feat(firestore): Increase HTTP/2 flow control window#10116

Open
dlarocque wants to merge 5 commits into
mainfrom
dl/flow-control
Open

feat(firestore): Increase HTTP/2 flow control window#10116
dlarocque wants to merge 5 commits into
mainfrom
dl/flow-control

Conversation

@dlarocque

@dlarocque dlarocque commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Allows configuring the gRPC flow control window in Node.js environments. Also sets the default flow control window size to 256KB (from the 64KB gRPC default).

  1. Increases the default HTTP/2 flow control window size from 64 KB to 256 KB.
  2. Adds a new grpcFlowControlWindow configuration option to FirestoreSettings.

This change is aiming to reduce latency of large document reads in Firestore. There's a possibility that this change increases memory usage in heavy workloads which execute a large number of large document reads concurrently, which could be an issue in memory-constrained environments such as Cloud Functions with 256 MB RAM. If you believe this change introduce a regression in your app, you can revert it with the following:

const firestore = initializeFirestore(app, {
  grpcFlowControlWindow: 64 * 1024 // 64 KB
});

…imentalGrpcFlowControlWindow setting for Node.js

Allows configuring the gRPC flow control window in Node.js environments.
Also sets the default flow control window size to 256KB (from the 64KB gRPC default).
@dlarocque dlarocque requested review from a team as code owners June 24, 2026 20:09
@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1d4cdcf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
firebase Minor
@firebase/firestore Minor
@firebase/firestore-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dlarocque dlarocque requested a review from wu-hui June 24, 2026 20:09

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request increases the default HTTP/2 flow control window size from 64 KB to 256 KB for Node.js environments and introduces a new "experimentalGrpcFlowControlWindow" configuration option in "FirestoreSettings". The review feedback recommends adding an upper bound validation of 2,147,483,647 (2^31 - 1) to "experimentalGrpcFlowControlWindow" to comply with the HTTP/2 specification and prevent potential runtime connection failures, along with a corresponding unit test to verify this limit.

Comment thread packages/firestore/src/lite-api/settings.ts Outdated
Comment thread packages/firestore/test/unit/api/database.test.ts Outdated
@dlarocque dlarocque requested a review from a team as a code owner June 24, 2026 20:40
…lWindow

Drops the 'experimental' prefix from the setting name to maintain consistency with the Android API and avoid overloading the experimental prefix (which is reserved for long-polling). Also includes validation against the HTTP/2 maximum legal limit of 2147483647.

// @public
export interface Settings {
experimentalGrpcFlowControlWindow?: number;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would remove experimental?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants