-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Conversation
etcdmain/grpc_proxy.go
Outdated
PermitWithoutStream: false, | ||
})) | ||
} | ||
if grpcKeepAliveInterval > time.Duration(0) && |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
LGTM. Can you add this to the change log? |
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.