Skip to content

Commit 1a6265f

Browse files
Pramodh-GPramodh-G
authored andcommitted
grpc: Deprecate InitialWindowSize and introduce InitialStreamWindowSize
Part of #7923. Since it has been two releases after #8283 is merged, we can introduce InitialStreamWindowSize on both server and client, while deprecating InitialWindowSize. RELEASE NOTES: * grpc: Introduce new ServerOption and ClientOption to set stream window size without disabling BDP estimation. * grpc: Behavior change in WithInitialWindowSize in ClientOption and InitialWindowSize in ServerOption. Using these options will no longer disable BDP estimation. To explicitly disable BDP estimation, please use *StaticStreamWindowSize options. * grpc: Mark WithInitialWindowSize for deprecation, to be replaced with WithInitialStreamWindowSize in ClientOption. Similarly, for InitialWindowSize inServerOption to be replaced with InitialStreamWindowSize.
1 parent f448a97 commit 1a6265f

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

dialoptions.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,13 @@ func WithReadBufferSize(s int) DialOption {
210210
// WithInitialWindowSize returns a DialOption which sets the value for initial
211211
// window size on a stream. The lower bound for window size is 64K and any value
212212
// smaller than that will be ignored.
213+
//
214+
// Deprecated: use WithInitialStreamWindowSize to set a stream window size without disabling
215+
// dynamic flow control.
216+
// Will be supported throughout 1.x.
213217
func WithInitialWindowSize(s int32) DialOption {
214218
return newFuncDialOption(func(o *dialOptions) {
215219
o.copts.InitialWindowSize = s
216-
o.copts.StaticWindowSize = true
217220
})
218221
}
219222

@@ -223,10 +226,17 @@ func WithInitialWindowSize(s int32) DialOption {
223226
func WithInitialConnWindowSize(s int32) DialOption {
224227
return newFuncDialOption(func(o *dialOptions) {
225228
o.copts.InitialConnWindowSize = s
226-
o.copts.StaticWindowSize = true
227229
})
228230
}
229231

232+
// WithInitialStreamWindowSize returns a DialOption which sets the value for
233+
// a initial window size on a stream. The lower bound for window size is 64K
234+
// and any value smaller than that will be ignored. Importantly, this does
235+
// not disable dynamic flow control.
236+
func WithInitialStreamWindowSize(s int32) DialOption {
237+
return WithInitialWindowSize(s)
238+
}
239+
230240
// WithStaticStreamWindowSize returns a DialOption which sets the initial
231241
// stream window size to the value provided and disables dynamic flow control.
232242
func WithStaticStreamWindowSize(s int32) DialOption {

server.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,13 @@ func ReadBufferSize(s int) ServerOption {
278278

279279
// InitialWindowSize returns a ServerOption that sets window size for stream.
280280
// The lower bound for window size is 64K and any value smaller than that will be ignored.
281+
//
282+
// Deprecated: use InitialStreamWindowSize to set a stream window size without disabling
283+
// dynamic flow control.
284+
// Will be supported throughout 1.x.
281285
func InitialWindowSize(s int32) ServerOption {
282286
return newFuncServerOption(func(o *serverOptions) {
283287
o.initialWindowSize = s
284-
o.staticWindowSize = true
285288
})
286289
}
287290

@@ -290,10 +293,16 @@ func InitialWindowSize(s int32) ServerOption {
290293
func InitialConnWindowSize(s int32) ServerOption {
291294
return newFuncServerOption(func(o *serverOptions) {
292295
o.initialConnWindowSize = s
293-
o.staticWindowSize = true
294296
})
295297
}
296298

299+
// InitialStreamWindowSize returns a ServerOption that sets the window size for a stream.
300+
// THe lower bound for a window size is 64K, and any value smaller than that will be ignored.
301+
// Importantly, this does not disable dynamic flow control.
302+
func InitialStreamWindowSize(s int32) ServerOption {
303+
return InitialWindowSize(s)
304+
}
305+
297306
// StaticStreamWindowSize returns a ServerOption to set the initial stream
298307
// window size to the value provided and disables dynamic flow control.
299308
// The lower bound for window size is 64K and any value smaller than that

0 commit comments

Comments
 (0)