Skip to content

gRPC Server's Connection Management #794

@momadvisor

Description

@momadvisor

I'm primarily implementing bidirectional streamings for real time data communication between clients and servers. My bidirectional streaming is designed to maintain a persistent connection once it's established. It's a service where the connection between the client and server must remain active 24/7.
However, I need to find a way for the server to detect if the user logs out or the connection is lost. It appears that dart grpc server cannot directly configure a connection timeout. ServerKeepAliveOptions's ping strike seems to be a passive disconnection mechanism, relying on the client's ping rather than an active server-initiated disconnect. Similarly, ServerSettings(concurrentStreamLimit: value) doesn't proactively terminate connections.

While client-side keepAlive can be configured, I'm looking for server-side solutions to manage connections when dealing with clients I don't control or in the event of a malicious attempt of exhausting my server's resources related with sockets or file descriptors.

Here are my specific questions:

  1. Can the server send keepalive pings to the client?
  2. Is it possible to configure the server to close idle connections that exceed a maximum allowed time without any RPC activity? (e.g. ServerParameters.MaxConnectionIdle or ServerParameters.MaxConnectionIdle of golang gRPC)
  3. How is server side connection cleanup currently implemented ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions