Skip to content

Best practices for reusing connections, concurrency #682

@pboyer

Description

@pboyer

Thank you for this great library! I wanted to inquire about an issue I'm having.

I have a fixed number of machines I wish to make potentially concurrent RPCs to.

I would like maintain a pool of connections (*grpc.ClientConn) to these machines.

Otherwise, for every RPC call I need to make a new connection, which has overhead (as I understand it) and also can exhaust the number of file descriptors when a large number of concurrent RPC's are taking place.

  1. What are the restrictions on using clients and connections concurrently?
  2. Can I simply maintain a single connection and attach multiple client stubs to it dynamically (more flexible), or can I only have a single stub of a given type for a connection?
  3. My expectation is that I need to maintain my own pool with occasional heartbeats to maintain the health of the connection. Is that correct?

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