1
0
Fork 0
mirror of https://github.com/Luzifer/nginx-sso.git synced 2024-12-21 05:11:17 +00:00
nginx-sso/vendor/google.golang.org/grpc/Documentation/keepalive.md
Knut Ahlers 9b3c895c04
Update dependencies
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2019-04-22 06:44:07 +02:00

1.7 KiB

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 close. 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.

What should I set?

It should be sufficient for most users to set client parameters as a dial option.

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 for details.

Enforcement policy

Enforcement policy 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