Skip to main content

The batching section of aerospike-pubsub-outbound.yml

The 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.

caution

It is possible to cause long periods of wait time if you do not configure batching properly.

OptionRequired?DefaultDescription
delay-thresholdNo1 millisecond (T0.001S)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 PnDTnHnMn.nS, where
  • P for "period" indicates that the next value is the number of days.
  • nD is the number of days. For example, 1D specifies one day.
  • T indicates that the next value or values specify the duration of time.
  • nH is the number of hours. For example, 1H specifies one hour.
  • nM is the number of minutes. For example, 1M specifies one minute.
  • n.nS is the number of seconds. You can use decimal numbers that have up to nine digits. For example, 3.141519S specifies 3.141519 seconds.
Examples:
  • T0.001S specifies one millisecond.
  • T2M and T120S both specify two minutes.
  • P1DT12H30M45S specifies one day, twelve hours, thirty minutes, and forty-five seconds.
element-count-thresholdNo1Corresponds 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.
flow-controlNoN/ASee "Controlling the flow of messages" below.
request-byte-thresholdNo1Once 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.

OptionRequired?Description
limit-exceeded-behaviorNoSpecifies what the connector should do if either of the specified limits is exceeded.
throw
Throws a FlowControlException.
block
Waits until the request can be made without exceeding the limit. This is the default value.
ignore
Ignores both limits.
max-outstanding-element-countNoMaximum number of outstanding elements to keep in memory before enforcing flow control.
max-outstanding-request-bytesNoMaximum number of outstanding bytes to keep in memory before enforcing flow control.

Example

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.

  • Controlling the flow of messages
  • Example