Skip to content

Conversation

@daniel-sanche
Copy link
Contributor

@daniel-sanche daniel-sanche commented Sep 6, 2023

While developing the bigtable client, we found that async gapic clients are very slow compared to raw grpc calls. Looking at the code, I found a couple low-hanging-fruit optimizations, some just needing a port over from the synchronous client code:

  • use cached wrapped functions, instead of wrapping the underlying grpc call before each rpc call
  • check if the input is the expected proto type, and avoid creating a new copy if so

These changes give ~5x speed up on a quick benchmark I threw together (1.99s -> 0.428s for unary, 1.839s -> 0.335s for streams. Network mocked out. 10,000 rpc tests), and bring rpc performance more in-line with the sync clients

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Sep 6, 2023
@daniel-sanche daniel-sanche marked this pull request as ready for review March 18, 2024 22:07
@daniel-sanche daniel-sanche requested a review from a team as a code owner March 18, 2024 22:07
@daniel-sanche daniel-sanche changed the title [DRAFT] chore: increase async rpc performance chore: increase async rpc performance Mar 18, 2024
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: m Pull request size is medium. labels Mar 19, 2024
Copy link
Contributor

@parthea parthea left a comment

Choose a reason for hiding this comment

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

Since this fixes a performance issue, please can you add a test to avoid regressions in peformance?

@parthea parthea marked this pull request as draft March 20, 2024 18:00
@daniel-sanche daniel-sanche force-pushed the async-optimizations branch 2 times, most recently from 3294431 to 2588269 Compare April 5, 2024 20:43
@daniel-sanche daniel-sanche merged commit a798f00 into main Apr 11, 2024
@daniel-sanche daniel-sanche deleted the async-optimizations branch April 11, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: xl Pull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants