Skip to content

Commit 89fe783

Browse files
authored
grpc: Document interactions between static flow control window options (#9096)
Fixes: #9090 Setting a static flow control window at either the stream or connection level entirely disables BDP estimation across the channel. If a user configures one without the other, the unspecified window falls back to the HTTP/2 default of 64KB, which can cause a severe drop in throughput. This PR documents these interactions to help users avoid this common footgun. RELEASE NOTES: N/A
1 parent 3d0dd1e commit 89fe783

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

dialoptions.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,14 @@ func WithInitialConnWindowSize(s int32) DialOption {
227227

228228
// WithStaticStreamWindowSize returns a DialOption which sets the initial
229229
// stream window size to the value provided and disables dynamic flow control.
230+
//
231+
// Note that this also disables dynamic flow control for the connection,
232+
// falling back to a default static connection-level window of 64KB. To
233+
// use a larger connection-level window, you must also use the
234+
// [WithStaticConnWindowSize] DialOption.
235+
//
236+
// Most users should not configure static flow control windows unless
237+
// operating in a memory-constrained environment.
230238
func WithStaticStreamWindowSize(s int32) DialOption {
231239
return newFuncDialOption(func(o *dialOptions) {
232240
o.copts.InitialWindowSize = s
@@ -237,6 +245,14 @@ func WithStaticStreamWindowSize(s int32) DialOption {
237245
// WithStaticConnWindowSize returns a DialOption which sets the initial
238246
// connection window size to the value provided and disables dynamic flow
239247
// control.
248+
//
249+
// Note that this also disables dynamic flow control for individual streams,
250+
// falling back to a default static connection-level window of 64KB. To
251+
// explicitly configure the stream-level window size, you must also use the
252+
// [WithStaticStreamWindowSize] DialOption.
253+
//
254+
// Most users should not configure static flow control windows unless
255+
// operating in a memory-constrained environment.
240256
func WithStaticConnWindowSize(s int32) DialOption {
241257
return newFuncDialOption(func(o *dialOptions) {
242258
o.copts.InitialConnWindowSize = s

server.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,14 @@ func InitialConnWindowSize(s int32) ServerOption {
300300
// window size to the value provided and disables dynamic flow control.
301301
// The lower bound for window size is 64K and any value smaller than that
302302
// will be ignored.
303+
//
304+
// Note that this also disables dynamic flow control for the connection,
305+
// falling back to a default static connection-level window of 64KB. To
306+
// use a larger connection-level window, you must also use the
307+
// [StaticConnWindowSize] ServerOption.
308+
//
309+
// Most users should not configure static flow control windows unless
310+
// operating in a memory-constrained environment.
303311
func StaticStreamWindowSize(s int32) ServerOption {
304312
return newFuncServerOption(func(o *serverOptions) {
305313
o.initialWindowSize = s
@@ -311,6 +319,14 @@ func StaticStreamWindowSize(s int32) ServerOption {
311319
// window size to the value provided and disables dynamic flow control.
312320
// The lower bound for window size is 64K and any value smaller than that
313321
// will be ignored.
322+
//
323+
// Note that this also disables dynamic flow control for individual streams,
324+
// falling back to a default static connection-level window of 64KB. To
325+
// explicitly configure the stream-level window size, you must also use the
326+
// [StaticStreamWindowSize] ServerOption.
327+
//
328+
// Most users should not configure static flow control windows unless
329+
// operating in a memory-constrained environment.
314330
func StaticConnWindowSize(s int32) ServerOption {
315331
return newFuncServerOption(func(o *serverOptions) {
316332
o.initialConnWindowSize = s

0 commit comments

Comments
 (0)