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

Make threadpool size configurable in publisher/consumer builder #1920

Open
pax95 opened this issue Jan 30, 2024 · 4 comments
Open

Make threadpool size configurable in publisher/consumer builder #1920

pax95 opened this issue Jan 30, 2024 · 4 comments
Assignees
Labels
api: pubsub Issues related to the googleapis/java-pubsub API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@pax95
Copy link

pax95 commented Jan 30, 2024

Currently it is very low level to override the default behaviour on how many threads are assigned to the publisher/consumer.

We are seeing too many GAX threads created for our usecase causing an overhead in memory consumption on k8s for low traffic situations.
There is some talk about it her

The documentation for override the pool size might be a bit to low leven for many situations.
It would be good if the pool would be configurable from outside especially since many users of pubsub are using a framework like spring-boot pubsub, or in our case apache camel google pubsub.

@alicejli alicejli added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Jan 30, 2024
@lqiu96
Copy link
Contributor

lqiu96 commented Feb 15, 2024

Thanks for raising this issue! I have a few questions to get a bit more clarity about the issue you're seeing.

Currently it is very low level to override the default behaviour on how many threads are assigned to the publisher/consumer.

Can you explain this part a bit more? I'm a bit confused what you mean by very low level. I took a look at the pubsub docs and I think there is a setting inside pubsub to configure the executor provider:

     ExecutorProvider executorProvider =
          InstantiatingExecutorProvider.newBuilder().setExecutorThreadCount(4).build();

      // `setExecutorProvider` configures an executor for the publisher.
      publisher = Publisher.newBuilder(topicName).setExecutorProvider(executorProvider).build();

It would be good if the pool would be configurable from outside

I'm also a bit confused by this part. What do you mean by configurable from outside?

@pax95
Copy link
Author

pax95 commented Feb 16, 2024

I think the internal threading model in pubsub might benefit from a better abstraction as eg. a configuration class, where users can override the default behaviour of pubsub (number of threads in pool asf.) , and then inject an instance of that when instantiating pubsub, or a method on the Publisher/Consumer to set no of threads.
In this way users do not have to deal with executors if they want to override the defaults.

@lqiu96
Copy link
Contributor

lqiu96 commented Feb 16, 2024

For an abstraction in pubsub, I think this would probably better suited as a feature request for the pubsub folks. I'll transfer the issue there and CC the some of the devs for their thoughts

@lqiu96 lqiu96 transferred this issue from googleapis/google-cloud-java Feb 16, 2024
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/java-pubsub API. label Feb 16, 2024
@lqiu96
Copy link
Contributor

lqiu96 commented Feb 16, 2024

CC @michaelpri10 @hannahrogers-google if you two have any thoughts on this

kamalaboulhosn pushed a commit to kamalaboulhosn/java-pubsub that referenced this issue Mar 14, 2024
…s#1869)

* chore: Create renovate_config_check.yaml
Source-Link: googleapis/synthtool@6612ab8
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:a6aa751984f1e905c3ae5a3aac78fc7b68210626ce91487dc7ff4f0a06f010cc

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
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. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants