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

fix: Prevent excessive string parsing when publishing and receiving messages to improve performance #2317

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

michaelpri10
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #2295 ☕️

Based off of PR #2304, which some added changes to the subscribe path.

@michaelpri10 michaelpri10 requested a review from a team as a code owner January 24, 2025 01:24
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: pubsub Issues related to the googleapis/java-pubsub API. labels Jan 24, 2025
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Jan 24, 2025
@MV-GH
Copy link

MV-GH commented Jan 24, 2025

Thanks for taking this up. I believe OpenTelemetryPubsubTracer.startPublishRpcSpan would also benefit from a similar change.

@@ -105,6 +106,7 @@ class MessageDispatcher {
private final Distribution ackLatencyDistribution;

private final String subscriptionName;
private final SubscriptionName subscriptionNameObject;
Copy link
Member

Choose a reason for hiding this comment

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

How does this new object interact with the previous subscriptionName string? Is the latter still necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The old String subscriptionName is actually no longer used, so I've removed it. subscriptionNameObject is created in the constructor using the string that is passed in to the builder, but that string is not needed after.

@michaelpri10
Copy link
Contributor Author

@hongalex Gentle bump on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/java-pubsub API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential (CPU) performance improvement when publishing
3 participants