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 streaming keepAlive doesn't work with docker swarm #2549
Comments
Did you also set https://godoc.org/google.golang.org/grpc/keepalive#EnforcementPolicy on the server? The default permitted value for time between client pings is 5 minutes ... if you set your client to ping every 30 seconds you'll need to set a matching policy on the gRPC server as well. |
Thanks for reminding, but my grpc server is based on c++. Is there any counterpart of EnforcementPolicy in grpc c++? |
I believe the C++ server still wraps gRPC core. You can find the settings here: Make sure to pay attention to the |
I tried the following configurations on c++ server and golang client to make sure that the permitted ping interval of c++(5 minutes by default) is smaller than the golang client, but it still doesn't work.
|
You definitely need to ping more often than every 10 min when using Docker / Docker Swarm. The Docker proxies timeout after 10 minutes ... we use 5 * time.Minute for the client keepalive time ... you can also try 6 as well ... anything less than 10 should keep idle connections open with Docker Swarm (or just Docker in general) |
@npuichigo - hopefully you were able to resolve this? |
@mastersingh24 - Yes, the problem has been solved. Thank you for your concern. |
Recently, I used the grpc-gateway to transcode HTTP/JSON to grpc. The gRPC-Gateway uses a gRPC client to talk to the backend, but in a docker swarm setup using overlay networks, idle connections between grpc client and backend service will end up in a broken state after 15 minutes. (moby/moby#31208)
So I tried the following two ways. Firstly, I set net.ipv4.tcp_keepalive_time to less than 900 seconds, to make sure the TCP connection between grpc-gateway and IPVS doesn't expire. Secondly, I configured grpc.WithKeepaliveParams to set the ping time interval to 30 seconds. However, neither method works.
Here is the code snippet of my client:
Is there anyway to configure grpc-go client to support docker swarm?
The text was updated successfully, but these errors were encountered: