Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: permit gRPC stream window sizes up to 64 MB #111255

Merged

Conversation

nvanbenschoten
Copy link
Member

@nvanbenschoten nvanbenschoten commented Sep 26, 2023

Informs #111238.
Informs #111241.

CockroachDB accepts a COCKROACH_RPC_INITIAL_WINDOW_SIZE environment variable that can be used to set the initial window size for gRPC streams. However, the setting could previously only be used to reduce the initial window size, not to increase it.

This commit fixes that, allowing the initial window size to be increased up to 64 MB. This is useful for multi-region clusters that want to push high volumes of writes over high-latency WAN links.

Release note (general change): Increased the maximum permitted value of the COCKROACH_RPC_INITIAL_WINDOW_SIZE environment variable to 64MB. When used in conjunction with a tuned OS-level maximum TCP window size, this can increase the throughput that Raft replication can sustain over high-latency network links.

@nvanbenschoten nvanbenschoten requested a review from a team as a code owner September 26, 2023 02:42
@blathers-crl
Copy link

blathers-crl bot commented Sep 26, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nvanbenschoten nvanbenschoten added backport-22.2.x backport-23.1.x Flags PRs that need to be backported to 23.1 labels Sep 26, 2023
@knz
Copy link
Contributor

knz commented Sep 26, 2023

Even with this change, I'm not sure how much traffic we can pump across regions until the OS-level TCP Window size is also tuned. See ref.

@knz
Copy link
Contributor

knz commented Sep 26, 2023

This could perhaps also benefit from a release note.

Copy link
Contributor

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

Note that higher window sizes carry a risk of OOMs, since this also affects the maximum size of gRPC's per-stream buffers. This was the motivation for the separate rangefeed connection class with a significantly lower initial window size: when rangefeed consumers struggled to keep up, we saw very high memory usage as gRPC stream buffers filled up across thousands of ranges.

CockroachDB accepts a COCKROACH_RPC_INITIAL_WINDOW_SIZE environment variable
that can be used to set the initial window size for gRPC streams. However, the
setting could previously only be used to reduce the initial window size, not to
increase it.

This commit fixes that, allowing the initial window size to be increased up to
64 MB. This is useful for multi-region clusters that want to push high volumes
of writes over high-latency WAN links.

Release note (general change): Increased the maximum permitted value of
the COCKROACH_RPC_INITIAL_WINDOW_SIZE environment variable to 64MB. When
used in conjunction with a tuned OS-level maximum TCP window size, this
can increase the throughput that Raft replication can sustain over high
latency network links.
@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/largerGRPCWindowSize branch from ef77bbd to 1f77f7f Compare September 26, 2023 15:12
@nvanbenschoten
Copy link
Member Author

I'm not sure how much traffic we can pump across regions until the OS-level TCP Window size is also tuned.

Agreed, this only allows the gRPC window size to keep up with the OS-level TCP window size, but that also need to be tuned. See the experimentation in #111241.

This could perhaps also benefit from a release note.

Done.

I've also opened to cockroachdb/docs#17924 to suggest in our docs that users increase this setting.

TFTRs!

bors r=knz,erikgrinaker

@craig
Copy link
Contributor

craig bot commented Sep 26, 2023

Build succeeded:

@craig craig bot merged commit f94ca65 into cockroachdb:master Sep 26, 2023
3 checks passed
@blathers-crl
Copy link

blathers-crl bot commented Sep 26, 2023

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 1f77f7f to blathers/backport-release-22.2-111255: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 22.2.x failed. See errors above.


error creating merge commit from 1f77f7f to blathers/backport-release-23.1-111255: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants