BATCHSZ (Batch Size)

Message channels move traffic across networks that charge latency per round trip. Sending one message per TCP interaction wastes capacity on a link between London and Sydney; batching groups multiple messages into fewer protocol exchanges. BATCHSZ on an IBM MQ channel definition tells the sender how many messages to accumulate before pushing a batch to the partner, subject to BATCHINT time limits and MAXMSGL per message. Operators tuning overnight batch feeds often raise BATCHSZ; operators tuning interactive traffic may lower it. This tutorial explains the attribute, how batching interacts with BATCHINT and channel states, tuning trade-offs, and mistakes such as maximizing BATCHSZ on low-volume routes where messages wait unnecessarily in the batch buffer.

What Happens During Batching

When an SDR instance is RUNNING and messages wait on the XMITQ, the channel agent dequeues messages up to BATCHSZ count. If BATCHINT expires first with fewer messages, it sends a partial batch. The partner RCVR accepts the batch and issues local puts. Larger BATCHSZ means fewer network turns for the same message count—especially valuable when RTT is tens or hundreds of milliseconds. On a fast LAN with tiny messages, extreme BATCHSZ may add delay before the first message leaves because the agent waits for a full batch that never arrives during low traffic.

BATCHSZ vs BATCHINT
AttributeUnitEffect
BATCHSZMessage countUpper bound on messages per batch
BATCHINTMillisecondsSend batch when timer fires even if not full
MAXMSGLBytesMax size of each message in batch

Defining BATCHSZ

shell
1
2
3
4
5
6
7
DEFINE CHANNEL('QM1.TO.QM2') CHLTYPE(SDR) TRPTYPE(TCP) + CONNAME('qm2.corp(1414)') XMITQ('XMIT.QM2') + BATCHSZ(50) BATCHINT(100) MAXMSGL(4194304) ALTER CHANNEL('QM1.TO.QM2') CHLTYPE(SDR) BATCHSZ(100) DISPLAY CHANNEL('QM1.TO.QM2') BATCHSZ BATCHINT * Partner RCVR — align batch attributes ALTER CHANNEL('QM1.TO.QM2') CHLTYPE(RCVR) BATCHSZ(50) BATCHINT(100)

BATCHSZ(50) with BATCHINT(100) means “up to fifty messages, or whatever is ready after about 100 ms, whichever comes first”—simplified explanation for beginners. Platform defaults exist; do not assume defaults suit your WAN. Change one attribute at a time in test and measure XMITQ drain rate and end-to-end latency percentiles.

Explainer: Filling a Crate Before Shipping

BATCHSZ is how many toy boxes you put in one crate before the truck leaves. If the crate is not full but the clock rings (BATCHINT), you send the crate anyway so the last box is not waiting all day.

Throughput vs Latency

High BATCHSZ improves megabytes per second on busy links because protocol overhead is amortized. The last message in a batch waits for earlier messages to fill the batch or for BATCHINT—adding tail latency. Real-time payment routes may use BATCHSZ 10 and BATCHINT 50; bulk replication may use BATCHSZ 500 and BATCHINT 500. There is no universal best value—only measurement on your path.

Interaction with Persistent Messages

Persistent messages on the XMITQ survive queue manager restart; batching does not weaken persistence. Channel agents still commit batches according to MQ protocol rules. Slow batching under high BATCHSZ during a backlog can make CURDEPTH drop in bursts rather than smoothly—monitoring tools should use rates, not only snapshots.

When Not to Raise BATCHSZ

  • Low message rate—messages wait in batch with no benefit.
  • Strict per-message latency SLA under 100 ms.
  • Very large messages near MAXMSGL—batch count may be memory-heavy.
  • Partner CPU saturated—faster batches may worsen receiver put rate.

Troubleshooting

  1. Spiky latency after BATCHSZ increase—try lower BATCHINT or BATCHSZ.
  2. Throughput flat—bottleneck may be disk, TLS, or target queue, not batching.
  3. Only one side altered—verify partner channel attributes.
  4. Compare MSGS rate on CHSTATUS before and after tuning in test window.

Explain Like I'm Five: BATCHSZ

BATCHSZ is how many letters you put in one envelope before mailing, instead of mailing each letter separately.

Practice Exercises

Exercise 1

BATCHSZ 100, BATCHINT 5000, one message per second arrives. Describe batch behavior.

Exercise 2

Why measure latency and throughput when changing BATCHSZ?

Exercise 3

Can one message larger than MAXMSGL ride in a batch? Explain.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. BATCHSZ limits:

  • Messages per batch
  • Seconds between heartbeats
  • SSL cipher
  • Queue depth

2. BATCHINT works with BATCHSZ by:

  • Sending partial batch when timer expires
  • Replacing TCP
  • Setting MAXDEPTH
  • Naming channels

3. Each message in a batch must respect:

  • MAXMSGL
  • MAXDEPTH only
  • Listener name
  • DLQ only

4. Higher BATCHSZ on WAN often:

  • Improves throughput
  • Disables TLS
  • Removes XMITQ
  • Stops listeners
Published
Read time16 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation