googleapis / googleapis/google-cloud-cpp
Sharing a pool of gRPC threads/connections with N topics for Pub/Sub?
- Ngôn ngữ chính
- C++
- Star
- 659
- Fork
- 462
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 89
Mô tả
**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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với tài liệu tham chiếu về tính an toàn luồng của Pub/Sub Publisher và phần triển khai MakePublisherConnection được đề cập trong issue. Xác định xem một thread pool có thể được dùng chung cho nhiều topic hay không, sau đó ghi lại cách sử dụng dự kiến bằng một ví dụ hoặc hướng dẫn tập trung; công việc được coi là hoàn tất khi hành vi của kết nối nhiều topic và thread pool đã rõ ràng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp, gcp, grpc
- Lĩnh vực
- documentation
- Loại issue
- Tài liệu
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100