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

grpc: update dial/server buffer options to support a "disable" setting #2147

Merged
merged 3 commits into from
Jun 27, 2018

Conversation

MakMukhi
Copy link
Contributor

fixes #2013

clientconn.go Outdated
@@ -150,6 +150,8 @@ func WithWriteBufferSize(s int) DialOption {

// WithReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most
// for each read syscall.
// A negative value will disable read buffer for a connection so data framer can access the underlying
Copy link
Member

Choose a reason for hiding this comment

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

Zero seems like a pretty good "disable" value to me.. It seems the problem is that we don't have a "default{Dial,Server}Options", but we do for "defaultCallOptions", right? Could you look into adding some non-zero defaults that way if it's not too hard?

@dfawley dfawley assigned MakMukhi and unassigned dfawley Jun 19, 2018
@dfawley dfawley added the Type: Feature New features or improvements in behavior label Jun 19, 2018
@dfawley dfawley changed the title Allow an option to disable I/O read buffer. client, server: update dial/server buffer options to support a "disable" setting Jun 19, 2018
@@ -150,6 +150,8 @@ func WithWriteBufferSize(s int) DialOption {

Copy link
Member

Choose a reason for hiding this comment

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

Should we also do the same thing with the write buffers while we're at it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@MakMukhi MakMukhi force-pushed the disable_read_buffer branch 2 times, most recently from 17be597 to 504bbd9 Compare June 20, 2018 22:51
clientconn.go Outdated
func defaultDialOptions() dialOptions {
return dialOptions{
copts: transport.ConnectOptions{
WriteBufferSize: -1,
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to use defaultWriteBufSize instead (and move the const into the grpc package instead of transport)?

@MakMukhi MakMukhi assigned dfawley and MakMukhi and unassigned MakMukhi and dfawley Jun 21, 2018
Copy link
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.

Thanks!

clientconn.go Outdated
@@ -142,6 +154,8 @@ func WithWaitForHandshake() DialOption {

// WithWriteBufferSize lets you set the size of write buffer, this determines how much data can be batched
// before doing a write on the wire.
// Zero will disable the write buffer such that each write will be on underlying connection.
// Note: A Send call may not directly translate to a write.
Copy link
Member

Choose a reason for hiding this comment

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

Please document the default value here (and also for read).

Choose a reason for hiding this comment

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

Small note here, in fact gRPC allocates buffer of WriteBufferSize * 2 size, is it expected and maybe we should update documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@dfawley dfawley assigned MakMukhi and unassigned dfawley Jun 22, 2018
@MakMukhi MakMukhi merged commit 3ec535a into grpc:master Jun 27, 2018
@dfawley dfawley added this to the 1.14 Release milestone Jun 28, 2018
@menghanl menghanl changed the title client, server: update dial/server buffer options to support a "disable" setting grpc: update dial/server buffer options to support a "disable" setting Jul 25, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance: Provide means to disable read buffer
3 participants