Batch Processing

Details on controlling how AdapterRow instances are sent and processed by Event Stream Processor.

Sending individual AdapterRow instances to Event Stream Processor results in minimal latency but can reduce overall throughput due to network overhead. Sending AdapterRow instances using batch processing or blocks can improve overall throughput with some reduction in latency. See Batch Processing in the Programmers Guide for additional details.

AdapterRow instances are published to ESP individually when the AdapterRow is not a part of a block. In this case, it is sent over the network to ESP when the sendRow() or sendRowData() method is invoked.

A block may be demarcated explicitly within the source code or implicitly using the adapter configuration file. A block is demarcated explicitly when either a BATCH_START flag (sends the block using envelopes) or a TRANS_START flag (sends the block using transactions) is set in the current or preceding AdapterRow instances. The end of a block is demarcated by an AdapterRow instance with a BLOCK_END flag, or when an AdapterRow is sent to ESP with the sendEnd() method instead of the sendRow() or sendRowData() methods.

If the AdapterRow instance is not explicitly part of a block and the optional EspPublisher module property MaxPubPoolSize is set to a value greater than 1, the adapter framework automatically uses blocks to transmit the records. The MaxPubPoolSize parameter specifies the maximum size of the record pool before all records in the pool are published. If the optional EspPublisher module property MaxPubPoolTime is configured, this also causes publishing of the record pool in blocks. MaxPubPoolTime specifies the maximum period of time, in milliseconds, for which records are pooled before being published. If the threshold value of either of these two parameters are reached, the record pool is published using blocks. A third optional configuration property, UseTransactions, controls whether the blocks are published using envelopes or transactions.

In the event blocks are not demarcated explicitly in the adapter code, and are not implicitly used based on the adapter configuration, records are published individually.

A typical transaction block using AdapterRow might look like this:
  1. An AdapterRow with a block flag that is set to TRANS_START
  2. Various AdapterRows with block flags that are set to BLOCK_DATA
  3. An AdapterRow with a block flag set to BLOCK_END

For AdapterRow instances with no data and only the start or end flag, set each data position in the instance to null. See the $ESP_HOME/adapters/framework/examples/src/com/sybase/esp/adapter/framework/examplemodules/ExampleRowInputTransporter.java example for publishing AdapterRow instances in various ways.

Note that an AdapterRow instance cannot contain records from multiple transactions. If using blocks, records from an AdapterRow instance publish in one transaction or envelope.

Related reference
Event Stream Processor Publisher Module Parameters