snapshot of https://github.com/grpc/grpc-go.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
codecov / upload (push) Failing after 13m59s
CodeQL / Analyze (push) Failing after 1s
Testing / vet-proto (push) Failing after 1s
Testing / tests (arm, latest) (push) Waiting to run
Testing / extras (latest) (push) Failing after 1s
Testing / static checks (latest-1) (push) Failing after 1s
Testing / tests (-race, latest) (push) Failing after 1s
Testing / tests (i386, latest) (push) Failing after 1s
Testing / tests (latest) (push) Failing after 1s
Testing / tests (latest-1) (push) Failing after 1s
Lock Threads / lock (push) Failing after 1s
govulncheck / govulncheck (.) (push) Failing after 1s
govulncheck / govulncheck (./cmd/protoc-gen-go-grpc) (push) Failing after 1s
govulncheck / govulncheck (./gcp/observability) (push) Failing after 1s
govulncheck / govulncheck (./security/advancedtls) (push) Failing after 1s
govulncheck / govulncheck (./stats/opencensus) (push) Failing after 1s
Stale bot / stale (push) Failing after 1s
Some checks failed
codecov / upload (push) Failing after 13m59s
CodeQL / Analyze (push) Failing after 1s
Testing / vet-proto (push) Failing after 1s
Testing / tests (arm, latest) (push) Waiting to run
Testing / extras (latest) (push) Failing after 1s
Testing / static checks (latest-1) (push) Failing after 1s
Testing / tests (-race, latest) (push) Failing after 1s
Testing / tests (i386, latest) (push) Failing after 1s
Testing / tests (latest) (push) Failing after 1s
Testing / tests (latest-1) (push) Failing after 1s
Lock Threads / lock (push) Failing after 1s
govulncheck / govulncheck (.) (push) Failing after 1s
govulncheck / govulncheck (./cmd/protoc-gen-go-grpc) (push) Failing after 1s
govulncheck / govulncheck (./gcp/observability) (push) Failing after 1s
govulncheck / govulncheck (./security/advancedtls) (push) Failing after 1s
govulncheck / govulncheck (./stats/opencensus) (push) Failing after 1s
Stale bot / stale (push) Failing after 1s
This commit is contained in:
57
Documentation/keepalive.md
Normal file
57
Documentation/keepalive.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# Keepalive
|
||||
|
||||
gRPC sends http2 pings on the transport to detect if the connection is down. If
|
||||
the ping is not acknowledged by the other side within a certain period, the
|
||||
connection will be closed. Note that pings are only necessary when there's no
|
||||
activity on the connection.
|
||||
|
||||
For how to configure keepalive, see
|
||||
https://godoc.org/google.golang.org/grpc/keepalive for the options.
|
||||
|
||||
## Why do I need this?
|
||||
|
||||
Keepalive can be useful to detect TCP level connection failures. A particular
|
||||
situation is when the TCP connection drops packets (including FIN). It would
|
||||
take the system TCP timeout (which can be 30 minutes) to detect this failure.
|
||||
Keepalive would allow gRPC to detect this failure much sooner.
|
||||
|
||||
Another usage is (as the name suggests) to keep the connection alive. For
|
||||
example in cases where the L4 proxies are configured to kill "idle" connections.
|
||||
Sending pings would make the connections not "idle".
|
||||
|
||||
## What should I set?
|
||||
|
||||
It should be sufficient for most users to set [client
|
||||
parameters](https://godoc.org/google.golang.org/grpc/keepalive) as a [dial
|
||||
option](https://godoc.org/google.golang.org/grpc#WithKeepaliveParams).
|
||||
|
||||
## What will happen?
|
||||
|
||||
(The behavior described here is specific for gRPC-go, it might be slightly
|
||||
different in other languages.)
|
||||
|
||||
When there's no activity on a connection (note that an ongoing stream results in
|
||||
__no activity__ when there's no message being sent), after `Time`, a ping will
|
||||
be sent by the client and the server will send a ping ack when it gets the ping.
|
||||
Client will wait for `Timeout`, and check if there's any activity on the
|
||||
connection during this period (a ping ack is an activity).
|
||||
|
||||
## What about server side?
|
||||
|
||||
Server has similar `Time` and `Timeout` settings as client. Server can also
|
||||
configure connection max-age. See [server
|
||||
parameters](https://godoc.org/google.golang.org/grpc/keepalive#ServerParameters)
|
||||
for details.
|
||||
|
||||
### Enforcement policy
|
||||
|
||||
[Enforcement
|
||||
policy](https://godoc.org/google.golang.org/grpc/keepalive#EnforcementPolicy) is
|
||||
a special setting on server side to protect server from malicious or misbehaving
|
||||
clients.
|
||||
|
||||
Server sends GOAWAY with ENHANCE_YOUR_CALM and close the connection when bad
|
||||
behaviors are detected:
|
||||
- Client sends too frequent pings
|
||||
- Client sends pings when there's no stream and this is disallowed by server
|
||||
config
|
||||
Reference in New Issue
Block a user