Yuki
Yuki

Reputation: 4163

Go/C++ gRPC client channel and stub lifecycle

I have several Go and C++ services, that act as servers and clients, i.e. those are long-living services, that from time-to-time talk to other services.

I cannot find anywhere in gRPC docs whether the client channels and stubs should be long-lasting reusable objects or they should be created on every call. Or, maybe, I should create some kind of a channel/stub pool, where a pair of a channel and a stub exists, for example, for each thread and gets updated, refreshed on some interval or condition.

Upvotes: 3

Views: 1306

Answers (1)

Ala_b
Ala_b

Reputation: 51

According to official docs, you are encouraged to reuse stubs and channels when possible.

https://grpc.io/docs/guides/performance/

Upvotes: 1

Related Questions