Skip to content

[Flink][PubsubIO] Make the unbounded source's scale-out and in-flight cap configurable - #41906

Draft
nadberezny wants to merge 1 commit into
apache:masterfrom
nadberezny:pubsub-unbounded-source-tuning
Draft

nadberezny wants to merge 1 commit into
apache:masterfrom
nadberezny:pubsub-unbounded-source-tuning

Conversation

@nadberezny

Copy link
Copy Markdown

PubsubUnboundedSource hardcodes the readers per split (SCALE_OUT = 4) and the cap on unacked messages per reader (MAX_IN_FLIGHT = 20000).
The right values depend on the client and the checkpoint interval. For example, a custom PubsubClientFactory that doesn't block on pull gains nothing from extra readers.

This adds the PubsubOptions settings pubsubReadScaleOut and pubsubReadMaxInFlight. They default to the current values, so nothing changes unless you set them.

Tested in PubsubUnboundedSourceTest.

…nfigurable

PubsubUnboundedSource hardcodes two read settings that depend on the
runner and the client:

- SCALE_OUT (4): readers created per split the runner asks for, to hide
  the latency of blocking unary pulls. With a client that pulls in the
  background (for example StreamingPull through a custom
  PubsubClientFactory) the extra readers only add connections.
- MAX_IN_FLIGHT (20000): received but unacked messages per reader.
  Messages are acked when the checkpoint covering them is finalized, so
  this bounds how far reading runs ahead of checkpointing, and should
  follow the checkpoint interval and message rate.

Add the pipeline options pubsubReadScaleOut and pubsubReadMaxInFlight,
with the current values as defaults. Nothing changes unless they are
set. Not used on Dataflow, which replaces the source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nadberezny
nadberezny marked this pull request as draft December 3, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant