pubsub/gcppubsub: Consider publish request body size limitation when batching#3005
Merged
vangent merged 4 commits intoJun 2, 2021
Conversation
vangent
requested changes
May 26, 2021
Contributor
Author
|
Thank you for the review @vangent, I believe I addressed all the feedback in my latest push. Please let me know if anything else needed here. |
vangent
approved these changes
Jun 2, 2021
Codecov Report
@@ Coverage Diff @@
## master #3005 +/- ##
==========================================
+ Coverage 69.43% 69.54% +0.11%
==========================================
Files 111 112 +1
Lines 11684 11700 +16
==========================================
+ Hits 8113 8137 +24
+ Misses 2902 2896 -6
+ Partials 669 667 -2
Continue to review full report at Codecov.
|
Contributor
|
Thanks for the contribution! |
tonyhb
added a commit
to tonyhb/go-cloud
that referenced
this pull request
Mar 18, 2026
We currently estimate the size of the batch and limit batch sizes to <= 10MB for GCP PubSub (google#3005). This estimate can be wrong (by eg ~30kb). In these cases, we don't want data loss. Instead, if the batch is too large we split the batch in half then send both batches. This obviously assumes the estimate isn't off by a factor of 2, which we've never seen in prod. Also, ideally, we wouldn't even make the OG request and instead would inspect the size of the protobuf before sending over the wire. This requires changes to Google Cloud's apiv1 driver, so that's out of scope for gocloud.dev. In this case, we'll deal with a failing outbound request then attempt to recover.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows configuring a maximum batch size in bytes on the batcher in an attempt to respect the GCP 10MB limitation per publish request_size as documented in https://cloud.google.com/pubsub/quotas.
Happy to add tests if this limitation should be enforced at the batcher level like proposed in this PR.