googleapis / googleapis/google-cloud-cpp

Sharing a pool of gRPC threads/connections with N topics for Pub/Sub?

Open
#13,707 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: feature request
Dominant language
C++
Stars
659
Forks
463
Avg merge
1d 2h
Merged PRs (30d)
89

Description

What component of google-cloud-cpp is this feature request for?
Pub/Sub

Is your feature request related to a problem? Please describe.
Thanks for a great product. I've been looking at your samples for using the Pub/Sub publisher class. There is one example in particular where it shows you how to pass in your own thread pool:
https://cloud.google.com/cpp/docs/reference/pubsub/latest/classgoogle_1_1cloud_1_1pubsub_1_1Publisher#thread-safety

I had some suspicions about gRPC connections and the like, so I dug into the source code.

Each call of MakePublisherConnection is still tied to a topic. It is unclear if can use the same thread pool for multiple calls to MakePublisherConnection or not. Inside MakePublisherConnection I see gRPC channels being connected per thread, so I'm assuming that it's not expected to use the same thread pool across multiple topics?

That leaves me to my point of confusion. What is the expected usage for a scenario that I would assume is common:

  1. You have multiple topics you publish to
  2. You want a pool of gRPC connections that can be shared across all topics

Describe the solution you'd like
I would like a sample to document that, or even have this issue be the documentation.

Describe alternatives you've considered
I am currently iterating on ways I can play with the API to do what I expect, but it isn't ideal.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Pub/Sub Publisher thread-safety reference and the MakePublisherConnection implementation mentioned in the issue. Determine whether one thread pool can be shared across multiple topics, then document the expected usage with a sample or focused guidance; done means the multi-topic connection and thread-pool behavior is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, gcp, grpc
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.