sjvanrossum opened a new issue, #31828: URL: https://github.com/apache/beam/issues/31828
### What would you like to happen? Adding support for writes with ordering keys without making breaking changes in `PubsubUnboundedSink` limits the output key range to topic + 32 bits ordering key hash. The current scheme for messages without an ordering key uses an `int` to distribute messages across 100 fixed shards to improve performance since `PubsubClient` executes publishes as a blocking operation (potential FR to use async as showcased in the Pub/Sub client library for Java). Hash bucketing for ordering keys in Pub/Sub uses a hash output >32 bits, so the potential parallelism available to Beam is less than what Pub/Sub could support. Passing the entire ordering key (1024 bytes max) unmodified or aligning the hash output size (and potentially the algorithm) with Pub/Sub would enable Beam to fully utilize the available parallelism where possible. `GroupIntoBatches` with a custom `ShardedKey` would enable this since the shard field of `ShardedKey` is defined as a `byte[]`. `GroupIntoBatches.WithShardedKey` would allow runners to take advantage of auto-sharding instead of the fixed 100 output shards for messages without ordering keys. Lastly, adding this sink could be used to consolidate the sinks for bounded and unbounded writes into one sink to clean up the `PubsubIO.Write` transform a bit. I have a few commits in progress for this which initially started as the default sink for #31608. Coupling these two features would bloat that PR unnecessarily and the design of this sink might complicate the review process. The proposed auto-sharding sink could be enabled independently for all types of writes through something like `PubsubIO.Write#withAutoSharding()`. I'll post the commit chain for this as a WIP PR sometime soon. ### Issue Priority Priority: 3 (nice-to-have improvement) ### Issue Components - [ ] Component: Python SDK - [X] Component: Java SDK - [ ] Component: Go SDK - [ ] Component: Typescript SDK - [X] Component: IO connector - [ ] Component: Beam YAML - [ ] Component: Beam examples - [ ] Component: Beam playground - [ ] Component: Beam katas - [ ] Component: Website - [ ] Component: Spark Runner - [ ] Component: Flink Runner - [ ] Component: Samza Runner - [ ] Component: Twister2 Runner - [ ] Component: Hazelcast Jet Runner - [ ] Component: Google Cloud Dataflow Runner -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
