MQ

 View Only

IBM MQ Little Gem #1: XBATCHSZ

By Morag Hughson posted Tue May 19, 2015 04:55 PM

  
This is part of a series of small blog posts which will cover some of the smaller, perhaps less likely to be noticed, features of IBM MQ. Read other posts in this series.

When tuning your IBM MQ queue manager channels to deliver messages in the most efficient way, it is useful to know how full your batches are, that is, are you achieving full batches.

Channel Batches

When delivering messages to a remote queue manager, a channel attempts to do so in the most efficient manner by sending a number of messages before asking the target system whether it received them all. This is known as batching. The channel is most efficient when it can send a larger number of messages for each of these confirmation flows, and least efficient when it is confirming each message individually.

However, this efficiency may come with some costs, specifically the need to retransmit more than one message should there be a network failure, and the availability of persistent messages since they are only committed on the target system once the batch has been confirmed. For many, stable networks and the use of non-persistent messages for any real-time traffic, mean that achieving full batches is the most efficient way to move messages.

How full are your batches?

So the question is then, how full are you batches? Traditionally you could calculate this using two values returned to you on DISPLAY CHSTATUS, the MSGS and BATCHES values.

AMQ8417: Display Channel Status details.
CHANNEL(MQG1.TO.MQG2)                   CHLTYPE(SDR)
BATCHES(20)                             CONNAME(127.0.0.1(1702))
CURRENT                                 MSGS(500)
RQMNAME(MQG2)                           STATUS(RUNNING)
SUBSTATE(MQGET)                         XMITQ(MQG2)

You would divide one by the other and it would tell you an average of how full your batches were. For example, imagine we sent 500 messages in 20 batches over a channel which has the maximum batch size (BATCHSZ) configured at 50. From those two values you can see that you are getting an average of 25 messages per batch. However the average doesn't tell you the whole story. It could be 20 equal sized batches with 25 in each, or 9 full batches of 50 and some smaller ones. It all rather depends on the arrival rate of your messages on the transmission queue of course!

One more attribute in your tool box which was added in WebSphere MQ V6, is a monitoring value XBATCHSZ. This is an MQ indicator value, which is means it provides a pair of values, a short term indicator and a long term indicator. These values keep a rolling average of your actual batch sizes. To have your channel calculate this you must enable channel monitoring by defining the channel to have MONCHL(HIGH). The short term indicator keeps the rolling average skewed more towards recent activity.

AMQ8417: Display Channel Status details.
CHANNEL(MQG1.TO.MQG2)                   CHLTYPE(SDR)
BATCHES(30)                             CONNAME(127.0.0.1(1702))
CURRENT                                 MSGS(520)
RQMNAME(MQG2)                           STATUS(RUNNING)
SUBSTATE(MQGET)                         XBATCHSZ(1,11)
XMITQ(MQG2)                          

Message Arrival Patterns

Let's now look at a few different patterns of message arrival and delivery.

Pattern A

Here we have an initial trickle of messages and then a large number of messages arriving on the transmission queue, so our short term indicator shows a high value because the most recent batches were full, but our long term indicator shows it wasn't always that way. Note that the indicators will never get all the way to full batches because it is calculating a rolling average and so is always affected by that initial set of small batches.

Graph of batch sizes for Pattern A

Pattern B

Here we have an initial large number of messages arriving on the transmission queue ensuring the first 10 batches are full, and then tailing off into a trickle, so our short term indicator shows a low value because the most recent batches were quite small, but the long term indicator show it was previously higher.

Graph of batch sizes for Pattern B

Pattern C

For this pattern, we have a steady flow of messages arriving on this transmission queue, such that each batch is not full but it is consistent. Both short and long term indicators show the same value so this is a consistent predictable pattern. Not a lot to see in a graph so I have not added one for this pattern. Given what you see above, if you ever see the XBATCHSZ indicators show the same value, and the calculated average you get from doing the division of BATCHES into MSGS yourself is also the same, you have had exactly the same size batches all through the running of this channel instance. Probably the only realistic way that is ever going to happen is with full batches!

Summary

Knowing how big your achieved batches are is only the start. Next step is to look into tuning them. There is a great resource that covers using BATCHINT, the SupportPac document MD0C: Keeping Channels Up and Running. Check it out!


Morag Hughson is an MQ expert. She spent 18 years in the MQ Devt organisation before taking on her current job writing MQ Technical education courses with MQGem. She also blogs for MQGem. You can connect with her here on IMWUC or on Twitter and LinkedIn.

#Little-Gem
#IBMMQ
#ChampionsCorner
1 comment
22 views

Permalink

Comments

Thu February 01, 2018 06:33 PM

Batches , Batchint and Uncomitted messages

I have tried the sceinario.
Created P2P connection from QM1 to PS1 queue managers. (MQ VERSION 8.0.0.4 , WINDOWS)
Remote Queue REQUEST in QM1 which is pointing to the local queue REQUESTIN in the PS1 QUEUE MANAGER.

Used amqsput sample to put messages on REQUEST queue and these are reaching to the REQUESTIN queue.

The scenario I tried here is :
1) I put one message in a REQUEST queue (on QM1) & small delay for second message.
2) Checked sdr channel status on QM1 and it showed BATCHES(0) and MESGS(2)
3) Checked REQUESTIN queue on PS1 Queue Manager , and current depth is 2 , as expected.
However since batch is not completed yet, I was expeting the messages on the REQUESTIN queue should be in uncommited state.
i.e. the UNCOM should have a value of 2. But instead its value is NO.

Is my understanding incorrect ? OR I am missing something.

Following are the definations of MQ attributes.
------------------------------------------------------------------------------------------------------------------------------------------------------
Queue Manager: QM1

display chl(qm1.to.ps1) batchint conname
169 : display chl(qm1.to.ps1) batchint conname
AMQ8414: Display Channel details.
CHANNEL(QM1.TO.PS1) CHLTYPE(SDR)
BATCHINT(30000) CONNAME(localhost(1415))

display chs(qm1.to.ps1) batches msgs xbatchsz
171 : display chs(qm1.to.ps1) batches msgs xbatchsz
AMQ8417: Display Channel Status details.
CHANNEL(QM1.TO.PS1) CHLTYPE(SDR)
BATCHES(0) CONNAME(127.0.0.1(1415))
CURRENT MSGS(2)
RQMNAME(PS1) STATUS(RUNNING)
SUBSTATE(MQGET) XBATCHSZ(1,1)
XMITQ(PS1.TRANSMITQ)

display qremote(REQUEST)
172 : display qremote(REQUEST)
AMQ8409: Display Queue details.
QUEUE(REQUEST) TYPE(QREMOTE)
ALTDATE(2018-02-01) ALTTIME(22.45.17)
CLUSNL( ) CLUSTER( )
CLWLPRTY(0) CLWLRANK(0)
CUSTOM( ) DEFBIND(OPEN)
DEFPRTY(0) DEFPSIST(NO)
DEFPRESP(SYNC) DESCR( )
PUT(ENABLED) RQMNAME(PS1)
RNAME(REQUESTIN) SCOPE(QMGR)
XMITQ(PS1.TRANSMITQ)
------------------------------------------------------------------------------------------------------------------------------------------------------
QUeue Manager : PS1

display chs(qm1.to.ps1)
22 : display chs(qm1.to.ps1)
AMQ8417: Display Channel Status details.
CHANNEL(QM1.TO.PS1) CHLTYPE(RCVR)
CONNAME(127.0.0.1) CURRENT
RQMNAME(QM1) STATUS(RUNNING)
SUBSTATE(RECEIVE)

display qs(requestin)
21 : display qs(requestin)
AMQ8450: Display queue status details.
QUEUE(REQUESTIN) TYPE(QUEUE)
CURDEPTH(2) IPPROCS(0)
LGETDATE( ) LGETTIME( )
LPUTDATE( ) LPUTTIME( )
MEDIALOG( ) MONQ(OFF)
MSGAGE( ) OPPROCS(1)
QTIME( , ) UNCOM(NO)

: