-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Support GRPC Keepalive without calls #258
Comments
Looking into this a bit more it looks like h2 doesn't support sending custom data on the keepalive. https://docs.rs/h2/0.2.1/h2/struct.Ping.html The other problem here will be that hyper doens't support ping either. So I would think for this custom behavior we would want to have a custom transport. But I don't like the idea of maintaining something that is not hyper. It might be worth it to open an issue for custom pings in the hyper repo. |
+1 |
I am a bit short on time today but the next steps would be to open the corresponding issues in cc @seanmonstar |
Some more details:
|
I did a little searching this is what I found: So very inconclusive. Yeah, I think it makes sense for hyper to expose some sort of config option for this. H3 still seems far away but we can introduce it as an http2 option? |
Also looks like we may need to echo exactly what is pinged to us in the ping frame. Reference: https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#ping-frame |
|
Relevant PR in hyper providing generic HTTP2 keep-alive support: hyperium/hyper#2151 |
hyper v0.13.4 now includes options to set some HTTP2 keep-alive options. So, next would be taking advantage of them in tonic. |
This has been done in #307 |
I was testing this out, and it does seem like there is a slight mismatch from the spec in terms of error codes returned. In hyperium/hyper#2151, KeepAliveTimedOut from h2 seems to get mapped to h2::Reason::INTERNAL_ERROR, but from here:
The error I was seeing was:
Does tonic get the information it needs to be able to map that to UNAVAILABLE, or would that require a change in h2? |
@seanmonstar ^ we likely want to forward that? |
We could maybe get hyper's error type to have |
I was able to take a closer look at hyper::Error and how it might integrate with tonic::Status. I'll follow up with that in #629 once I've had a chance to clean up some of the tests. It seems like there is a reasonable way to handle both the |
…Tonic server Summary: This diff introduces removing the "pinging" async task from the gRPC server and using the [[ hyperium/tonic#258 | gRPC http/2 keep-alive support ]] of the Tonic. The full context is located in the [[ https://linear.app/comm/issue/ENG-1842/consider-using-of-grpc-keep-alive-instead-of-ping-messages | ENG-1842 ]] task. [[ https://linear.app/comm/issue/ENG-1842/consider-using-of-grpc-keep-alive-instead-of-ping-messages#comment-e807b7f9 | Research and proof-of-work ]] of the gRPC keep-alive using Tonic. Related Linear task: [[ https://linear.app/comm/issue/ENG-1842/consider-using-of-grpc-keep-alive-instead-of-ping-messages | ENG-1842 ]] Test Plan: 1. Service is successfully built. 2. Tonic keep-alive [[ https://linear.app/comm/issue/ENG-1842/consider-using-of-grpc-keep-alive-instead-of-ping-messages#comment-e807b7f9 | "field" tests were successfully passed ]]. Reviewers: jon, marcin, varun, tomek Reviewed By: jon, varun, tomek Subscribers: ashoat, tomek, atul Differential Revision: https://phab.comm.dev/D5713
How can the tonic server be configured to allow PERMIT_KEEPALIVE_WITHOUT_CALLS? Currently I get RESOURCE_EXHAUSTED: HTTP/2 error code: ENHANCE_YOUR_CALM (Bandwidth exhausted) when I configure my client with keepAliveWithoutCalls = true |
Feature Request
Hello, the GRPC has it's own way of doing keepalive, besides you could use the
SO_KEEPALIVE
flag on the TCP socket. Currently, the GRPCHTTP 2
keepalive is not implemented. The ping part of the protocol can be found here. Here is the documentation of the GRPC part on this.Motivation
Without keepalive, long
idle
connections will be dropped, especially if you have, for instance, a network load balancer that doesn't know the protocol used.Proposal
Implement the GRPC oficial keepalive solution using HTTP 2 ping frames. The server needs to schedule those ping commands and handle the ACK (and the client).
GRPC - https://github.com/grpc/grpc/blob/master/doc/keepalive.md
HTTP 2 - https://http2.github.io/http2-spec/#PING
From the GRPC FAC:
The text was updated successfully, but these errors were encountered: