Title: Request batching does not track encoding overhead accurately · Issue #2106 · googleapis/java-pubsub · GitHub
Open Graph Title: Request batching does not track encoding overhead accurately · Issue #2106 · googleapis/java-pubsub
X Title: Request batching does not track encoding overhead accurately · Issue #2106 · googleapis/java-pubsub
Description: Steps to reproduce Set the byte size per batched request to >9.1 MB. Construct a batch of sufficiently large messages while respecting limits per message (max 10 MB data + attributes + ordering key, max 100 attributes, max 256 B per attr...
Open Graph Description: Steps to reproduce Set the byte size per batched request to >9.1 MB. Construct a batch of sufficiently large messages while respecting limits per message (max 10 MB data + attributes + ordering key...
X Description: Steps to reproduce Set the byte size per batched request to >9.1 MB. Construct a batch of sufficiently large messages while respecting limits per message (max 10 MB data + attributes + ordering ...
Opengraph URL: https://github.com/googleapis/java-pubsub/issues/2106
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Request batching does not track encoding overhead accurately","articleBody":"#### Steps to reproduce\r\n\r\n 1. Set the byte size per batched request to \u003e9.1 MB.\r\n 2. Construct a batch of sufficiently large messages while respecting limits per message (max 10 MB data + attributes + ordering key, max 100 attributes, max 256 B per attribute key, max 1024 B per attribute value, max 1024 B per ordering key) to exceed either the serialized size limit of 10 MB per `PublishRequest` or 10 MiB request size limit per call to publish (pointless because of the first limit unless explicit size validation is enabled).\r\n 3. Publish the batch.\r\n 4. Observe thrown exception, either an early rejection (\u003e10 MiB) or an internal error (\u003e10 MB, \u003c10 MiB) on request_size if explicit size validation isn't enabled for the topic.\r\n\r\n#### External references such as API reference guides\r\n\r\nThe API reference does not provide adequate documentation on these limits, since it suggests that explicit size validation is used. \r\n\r\n#### Any additional information below\r\n\r\nDiscovered this while reviewing size validation in `PubsubIO` for Apache Beam, see apache/beam#31800 for details.\r\nHappy to open a PR with fixes when I get a chance, just wanted to highlight this ahead of time for discussion.\r\n\r\nThis shouldn't be an issue if a user recovers by lowering the byte size per batch (\u003c9 MB is generally safe with current limits per message), but the client library should track the outgoing request size accurately on the user's behalf in my opinion.\r\n\r\nAlso note that allowing users to use the REST API for Pub/Sub as proposed in #2075 would complicate matters since the serialized size of publish requests sent as JSON can be smaller than the serialized size of the same requests after it's transcoded into protobuf. For this message type a protobuf message can be up to ~38 KB smaller or up to ~0.9 MB larger than its JSON counterpart.\r\nAn example of this would be a JSON publish request of 736 messages, each message with no data and 100 attributes, each attribute with no value and a key of 128 alphanumeric ASCII characters. The JSON request does not exceed 10 MB, but the protobuf transcoded request that's passed to Pub/Sub exceeds it by ~145 KB. That triggers the internal validation error without explicit size validation, but I guess this will become a non-issue when explicit size validation is used by default.","author":{"url":"https://github.com/sjvanrossum","@type":"Person","name":"sjvanrossum"},"datePublished":"2024-07-08T16:44:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/2106/java-pubsub/issues/2106"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b8858a82-c275-6040-9a8c-78c7595984ce |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E3EC:4D0D3:2877EAF:33A4FC1:6991B558 |
| html-safe-nonce | 8636b2dff204ea8ef77d3689444532ed6e4de10d0c760d0576613bf9da171dd2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0VDOjREMEQzOjI4NzdFQUY6MzNBNEZDMTo2OTkxQjU1OCIsInZpc2l0b3JfaWQiOiI3NTIzNzU2MTY4NTI0NzA3MTYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | db521c4cc8daa8b38906d3c9828a77c6e796c6b65f86bc634cb6fbbe9d43413e |
| hovercard-subject-tag | issue:2396096985 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/java-pubsub/2106/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fa1d94b7e4fe72fdceb03cdb9362aeed68a145dbb120c0feb0c9d9ee45790dab/googleapis/java-pubsub/issues/2106 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fa1d94b7e4fe72fdceb03cdb9362aeed68a145dbb120c0feb0c9d9ee45790dab/googleapis/java-pubsub/issues/2106 |
| og:image:alt | Steps to reproduce Set the byte size per batched request to >9.1 MB. Construct a batch of sufficiently large messages while respecting limits per message (max 10 MB data + attributes + ordering key... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sjvanrossum |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/java-pubsub git https://github.com/googleapis/java-pubsub.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 203461480 |
| octolytics-dimension-repository_nwo | googleapis/java-pubsub |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 203461480 |
| octolytics-dimension-repository_network_root_nwo | googleapis/java-pubsub |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width