Skip to content

[improve][doc] Document producerConfig.batchingConfig for Pulsar Functions - #1215

Merged
david-streamlio merged 2 commits into
apache:mainfrom
david-streamlio:docs-fn-batching-config
Aug 25, 2026
Merged

[improve][doc] Document producerConfig.batchingConfig for Pulsar Functions#1215
david-streamlio merged 2 commits into
apache:mainfrom
david-streamlio:docs-fn-batching-config

Conversation

@david-streamlio

@david-streamlio david-streamlio commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Motivation

PIP-401 added a batchingConfig field to a function's producerConfig, letting a function enable or disable batching and tune the batch size, byte limit, publish delay, and batch builder.

None of it is documented. batchingConfig appears nowhere in the docs, and the ProducerConfig table in functions-cli.md lists every sibling field — maxPendingMessages, cryptoConfig, batchBuilder, compressionType — but not this one. All six sub-fields are invisible to anyone who has not read BatchingConfig.java.

Modifications

Add a BatchingConfig section covering the six fields with their defaults (enabled = true, batchingMaxPublishDelayMs = 10), and a batchingConfig row linking to it from the ProducerConfig table — the pattern the table already uses for cryptoConfigCryptoConfig.

Record that only Java applies it today. The Python and Go runtimes hard-code batching to enabled with a 10 ms maximum publish delay and ignore batchingConfig entirely, tracked as apache/pulsar#26390 and apache/pulsar#26391. Documenting the fields without saying so would just move the surprise rather than remove it: the configuration is accepted, stored, and echoed back by functions get, and then ignored.

Two further notes on rows that were already in the table, both describing current behaviour:

  • batchingConfig.batchBuilder takes precedence over producerConfig.batchBuilder, matching the Java runtime. A user who sets both and sees one ignored has no way to find that out today.
  • The Go client does not implement SNAPPY. instance.go maps it to LZ4 in the default arm of its compression switch, so a Go function configured with SNAPPY silently gets LZ4. This one is independent of the rest of the PR and easy to drop if you would rather it went separately.

Versioned docs

Supported versions today are 5.0.x, 4.2.x, and 4.0.x. PIP-401 added BatchingConfig in 4.1, so the field exists in 4.2.x and 5.0.x but not in 4.0.x, which is left unchanged.

The runtime note is identical in both versioned copies: neither release carries the Python or Go batching support, so batchingConfig is still Java-only there.

One remainder, deliberately not included: the SNAPPY note also holds for 4.0.x, but the rest of this change does not apply to that version, and a lone compression note there seemed better as its own change than as a stray edit here.

Follow-up

apache/pulsar#26392 and apache/pulsar#26393 make the Python and Go runtimes honour these settings. When those land, the note in this section needs to become a smaller one — roundRobinRouterBatchingPartitionSwitchFrequency stays Java-only, and maxPendingMessagesAcrossPartitions has no Go equivalent. I will open that as a separate PR rather than describing behaviour that has not shipped.

Documentation

This is the documentation change.

…tions

PIP-401 added a batchingConfig field to a function's producerConfig, letting a
function enable or disable batching and tune the batch size, byte limit, publish
delay, and batch builder. None of it is documented: "batchingConfig" appears
nowhere in the docs, and the ProducerConfig table lists every sibling field but
not this one, so all six of its sub-fields are invisible.

Add a BatchingConfig section covering the six fields with their defaults, and a
batchingConfig row linking to it from the ProducerConfig table, following the
pattern already used for cryptoConfig.

Record that only the Java runtime applies these settings today. The Python and Go
runtimes hard-code batching to enabled with a 10ms maximum publish delay and
ignore the configuration entirely (#26390, #26391), which is the kind of silent
mismatch this section exists to surface.

Two further notes on rows that were already in the table:

- batchingConfig.batchBuilder takes precedence over producerConfig.batchBuilder,
  so a user who sets both and sees one ignored can now find out why.
- The Go client does not implement SNAPPY; instance.go maps it to LZ4 in its
  default switch arm, so a Go function configured with SNAPPY silently gets LZ4.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Pulsar Functions CLI documentation to cover the previously undocumented producerConfig.batchingConfig settings introduced by PIP-401, including defaults and current runtime support limitations.

Changes:

  • Adds a batchingConfig row to the ProducerConfig table and links it to a new BatchingConfig section.
  • Documents the BatchingConfig fields, defaults, and notes that only the Java runtime currently applies these settings.
  • Adds notes clarifying precedence for batchBuilder and documenting Go’s behavior for SNAPPY compression.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/functions-cli.md
Comment on lines +160 to +162
A function that sets no `producerConfig`, or a `producerConfig` with no `batchingConfig`, gets batching
enabled with a maximum publish delay of 10 ms. This is the behaviour functions had before these settings
became configurable, and it is the same across the Java, Python, and Go runtimes.
…ed docs

The contribution guide asks that a documentation change applying to a supported
version update versioned_docs alongside docs/.

Supported versions today are 5.0.x, 4.2.x, and 4.0.x. PIP-401 added
BatchingConfig in 4.1, so the field exists in 4.2.x and 5.0.x but not in 4.0.x,
which is left unchanged.

The runtime note is identical in both: neither release carries the Python or Go
batching support, so batchingConfig is still Java-only there.
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.

2 participants