batching section corresponds to Pub/Sub's com.google.api.gax.batching.BatchingSettings API. By default, batching is turned on. When batching is turned on, requests from subscriber clients are queued. When any of the thresholds in the table below are reached, the queued requests are packaged together into a batch and set to Pub/Sub as a single RPC. When the response comes back, it is split apart into individual responses according to the individual input requests.
It is possible to cause long periods of wait time if you do not configure batching properly.
|No||1 millisecond (||Corresponds to the setting Delay Threshold. Counting from the time that the first message is queued, once this delay has passed, then send the batch. Uses a format similar to the ISO-8601 format for durations. The format is |
|No||1||Corresponds to the setting Element Count Threshold. Once this many messages are queued, send all of the messages in a single call, even if the delay threshold hasn't elapsed yet.|
|No||N/A||See "Controlling the flow of messages" below.|
|No||1||Once the number of bytes in the batched request reaches this threshold, send all of the messages in a single call, even if neither the delay or message count thresholds have been exceeded yet.|
Controlling the flow of messages
You can use the optional
flow-control section to prevent batching from accumulating messages without limit, resulting eventually in an OutOfMemory exception.
|No||Specifies what the connector should do if either of the specified limits is exceeded.|
|No||Maximum number of outstanding elements to keep in memory before enforcing flow control.|
|No||Maximum number of outstanding bytes to keep in memory before enforcing flow control.|
batching: # OPTIONAL. Settings conforming to com.google.api.gax.batching.BatchingSettings
element-count-threshold: 1 # OPTIONAL.
request-byte-threshold: 1 # OPTIONAL.
delay-threshold: P2D # OPTIONAL. ISO-8601 like duration format (PnDTnHnMn.nS).
flow-control: # OPTIONAL. Settings conforming to com.google.api.gax.batching.FlowControlSettings.
limit-exceeded-behavior: block # OPTIONAL. Options are [throw, block, ignore]
max-outstanding-element-count: 1 # OPTIONAL.
max-outstanding-request-bytes: 1 # OPTIONAL.