Skip to content

grpc: change existing dial/server options that set initial window size to not disable BDP estimation#9078

Open
easwars wants to merge 3 commits into
grpc:masterfrom
easwars:window_size_dialoption_with_bdp
Open

grpc: change existing dial/server options that set initial window size to not disable BDP estimation#9078
easwars wants to merge 3 commits into
grpc:masterfrom
easwars:window_size_dialoption_with_bdp

Conversation

@easwars
Copy link
Copy Markdown
Contributor

@easwars easwars commented Apr 20, 2026

Fixes #7923

Specifically, this PR handles part two of the proposal: #7923 (comment)

It also fixes existing tests that relied on BDP estimation being turned OFF to use the WithStaticXxx and StaticXxx options, and adds new tests that verify the behavior of all options in a e2e fashion.

RELEASE NOTES:

  • grpc: Deprecate WithInitialWindowSize and InitialWindowSize. These are replaced by WithInitialStreamWindowSize and InitialStreamWindowSize respectively.
  • grpc: Change behavior of existing options that set initial window size on client and server to not disable BDP estimation.

@easwars easwars requested a review from dfawley April 20, 2026 05:20
@easwars easwars added the Type: Behavior Change Behavior changes not categorized as bugs label Apr 20, 2026
@easwars easwars added this to the 1.82 Release milestone Apr 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.69%. Comparing base (06fc26a) to head (ccc1e52).

Files with missing lines Patch % Lines
dialoptions.go 50.00% 0 Missing and 1 partial ⚠️
server.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9078      +/-   ##
==========================================
+ Coverage   80.52%   80.69%   +0.16%     
==========================================
  Files         413      413              
  Lines       33543    33550       +7     
==========================================
+ Hits        27012    27072      +60     
+ Misses       4316     4284      -32     
+ Partials     2215     2194      -21     
Files with missing lines Coverage Δ
dialoptions.go 80.47% <50.00%> (+6.96%) ⬆️
server.go 66.57% <50.00%> (-0.67%) ⬇️

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@easwars easwars assigned eshitachandwani and unassigned dfawley Apr 21, 2026
@easwars easwars requested review from eshitachandwani and removed request for dfawley April 21, 2026 03:27
Copy link
Copy Markdown
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

Not a super thorough review; just high level - @eshitachandwani should still look more closely at the implementation.

Comment thread server.go Outdated
// stream. The lower bound for window size is 64K and any value smaller than
// that will be ignored. This does not disable dynamic flow control.
func InitialStreamWindowSize(s int32) ServerOption {
return InitialWindowSize(s)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a super nit but I would make the other one call this, since that one is deprecated, and you could even just document the other one as being the same as InitialStreamWindowSize (or "calls" this one or whatever). And similar for the dial option.

Comment thread test/window_size_test.go
// For the static case, we use a shorter deadline to verify no
// growth happens.
if !tc.wantGrowth {
ctx, cancel = context.WithTimeout(ctx, time.Second)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How long does it take to see growth when it is expected? I would assume much less than 1s, but just curious.

Comment thread test/end2end_test.go Outdated
// Set message size to exhaust largest of window sizes.
messageSize := max(max(wc.serverStream, wc.serverConn), max(wc.clientStream, wc.clientConn)) / int32(numOfIter-1)
messageSize = max(messageSize, 64*1024)
t.Logf("easwars: messageSize=%d", messageSize)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like some debugging logs got pushed by mistake. Can you please remove these?

Comment thread test/window_size_test.go
// Find the client socket. We need to wait for the subchannel and
// socket to be created and registered with channelz.
var sockets []*channelz.Socket
for {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: can we use verifyResultWithDelay instead of writing the waiting logic ourself?

Comment thread test/window_size_test.go Outdated
@@ -0,0 +1,359 @@
/*
*
* Copyright 2024 gRPC authors.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright 2024 gRPC authors.
* Copyright 2026 gRPC authors.

@easwars easwars assigned eshitachandwani and unassigned easwars May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Behavior Change Behavior changes not categorized as bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a way to adjust the initial window size that does not also disable BDP estimation

3 participants