Allow to pass connection to a client #26

Closed
opened 2023-05-02 08:31:43 +00:00 by fyrchik · 2 comments

Client is just an interface on top of some gRPC connection.
Currently, we Dial/Init inside, which makes it impossible to implement some connection pooling. Debugging is also not pleasant, especially if you are a fan of printf-style.

I suggest to allow passing raw *grpc.ClientConn as an argument to the client. If it is provided, we use the specified connection and (may be) do not close it.

cc @TrueCloudLab/storage-core-committers @TrueCloudLab/storage-core-developers

Client is just an interface on top of some gRPC connection. Currently, we Dial/Init inside, which makes it impossible to implement some connection pooling. Debugging is also not pleasant, especially if you are a fan of printf-style. I suggest to allow passing raw `*grpc.ClientConn` as an argument to the client. If it is provided, we use the specified connection and (may be) do not close it. cc @TrueCloudLab/storage-core-committers @TrueCloudLab/storage-core-developers
fyrchik added the
enhancement
discussion
labels 2023-05-02 08:31:57 +00:00
fyrchik added this to the v2.16.0 milestone 2023-05-02 08:31:59 +00:00
fyrchik removed this from the v2.16.0 milestone 2023-05-02 08:32:08 +00:00
Collaborator

The gRPC connection itself (namely, ClientConn which is a virtual connection) already does pooling, multiplexing and even manages reconnections. Why do we need to do any caching on our side?

The gRPC connection itself (namely, `ClientConn` which is a virtual connection) already does pooling, multiplexing and even manages reconnections. Why do we need to do any caching on our side?
Poster
Owner

We already have this https://git.frostfs.info/TrueCloudLab/frostfs-api-go/src/branch/master/rpc/client/options.go#L117

@ale64bit you are right, but AFAIK there is no way to prioritize particular RPCs. Cockroach does sth similar with connections for example bf25b7bf93/pkg/rpc/connection_class.go (L20)

Another possibility is to have multiple endpoints to the same node.

We already have this https://git.frostfs.info/TrueCloudLab/frostfs-api-go/src/branch/master/rpc/client/options.go#L117 @ale64bit you are right, but AFAIK there is no way to prioritize particular RPCs. Cockroach does sth similar with connections for example https://github.com/cockroachdb/cockroach/blob/bf25b7bf93a6b8e57557813957da263389796bb4/pkg/rpc/connection_class.go#L20 Another possibility is to have multiple endpoints to the same node.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-api-go#26
There is no content yet.