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

grpcproxy: make grpc keep alive related options configurable #11711

Merged
merged 1 commit into from
Apr 18, 2020

Conversation

mlmhl
Copy link
Contributor

@mlmhl mlmhl commented Mar 23, 2020

Currently grpc-proxy doesn't config keep alive related options, so it will use the default values provided by the underlay gprc library. If clients uses a keep alive ping interval smaller than server's default minTime, connections between server and clients will be closed and reopened frequently.

For example, kubernetes's apiserver uses a 30s keep alive ping interval which is a typical value used by many clients, grpc-proxy uses the default minTime 5m, provided by grpc. As 5m is much bigger than 30s, so the connections will be closed and reopened frequently due to too_many_pings error.

@mlmhl
Copy link
Contributor Author

mlmhl commented Mar 25, 2020

@jingyih @gyuho PTAL :)

PermitWithoutStream: false,
}))
}
if grpcKeepAliveInterval > time.Duration(0) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

we probably should return an error if only of the two points are set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I go through the GRPC's code again and found that these two options are independent of each other, if one of them are not set, the grpc server will fill it with the default values, see here. So I changed if grpcKeepAliveInterval > time.Duration(0) && grpcKeepAliveTimeout > time.Duration(0) to if grpcKeepAliveInterval > time.Duration(0) || grpcKeepAliveTimeout > time.Duration(0).

By the way, I think the main etcd code should also make this adjustment.

Currently grpc-proxy doesn't config keep alive related options, so it
will use the default values provided by the underlay gprc library. If
clients uses a keep alive ping interval smaller than server's default
minTime, connections between server and clients will be closed and
reopened frequently.
@xiang90
Copy link
Contributor

xiang90 commented Apr 15, 2020

LGTM. Can you add this to the change log?

mlmhl added a commit to mlmhl/etcd that referenced this pull request Apr 16, 2020
mlmhl added a commit to mlmhl/etcd that referenced this pull request Apr 16, 2020
@mlmhl
Copy link
Contributor Author

mlmhl commented Apr 16, 2020

Submitted a PR to update the CHANGELOG #11790 , @xiang90 PTAL :)

@xiang90 xiang90 merged commit 0461b3f into etcd-io:master Apr 18, 2020
mlmhl added a commit to mlmhl/etcd that referenced this pull request Apr 20, 2020
spzala added a commit that referenced this pull request Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants