Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: only open one GRPC channel per GrpcClient #4112

Closed
wants to merge 1 commit into from

Conversation

judahrand
Copy link
Contributor

@judahrand judahrand commented Aug 10, 2023

What does this PR address?

It is best practice to reuse channels where possible: https://grpc.io/docs/guides/performance/#general

For me, locally, this reduces latency by about by about 3ms for sync calls an 2ms for async calls.

Fixes #(issue)

Before submitting:

@judahrand judahrand requested a review from a team as a code owner August 10, 2023 13:05
@judahrand judahrand requested review from aarnphm and removed request for a team August 10, 2023 13:05
@judahrand judahrand changed the title perf: only open one GRPC channel GrpcClient perf: only open one GRPC channel per GrpcClient Aug 10, 2023
@judahrand judahrand force-pushed the grpc-channel branch 2 times, most recently from 9601e1d to 209f058 Compare August 10, 2023 15:17
It is best practice to keep the channel open for the lifecycle of the
client to avoid unnecessary reconnects.
service=service_name,
_grpc_channel_timeout=timeout,
)
@cached_property
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why this has to be cached?

@judahrand judahrand closed this Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants