MQ

 View Only

Morag's Quirks #8: MQI counts in Accounting and Statistics

By Morag Hughson posted Wed May 27, 2020 05:58 AM

  
Morag's
Quirks
This is part of an occasional series of small blog posts where I (Morag) will write about some of the quirks in IBM MQ, in the hope of invoking the response, "Well, I didn't know that!" Read other posts in this series.

On the distributed platform of IBM MQ, Accounting and Statistics data is provided as PCF format messages written to well known queues. Within these various sets of data, there are a number of MQI counts; especially in the MQI Statistics and MQI Accounting records, but also found in the Queue Accounting records.

Abacus image by HB - Own work, Public Domain, Link

This blog post is going to look more closely at some of these counters, specifically ones that I think could be assumed to mean one thing, when actually they mean something slightly different.

This post is going to look at the following counters:-

  • Open Count
  • Close Count
  • Put 1 Count

Example 1

When you collect MQI counts with your Accounting and Statistics for an application that uses the MQPUT1 verb, you may be surprised at the result. Here's an example of an ACCTMQI record for an application that did 3 x MQPUT1 calls.

Note: In all these examples I am using the simple Q program, which also does an open, and inquire, and a close of the queue manager object at the start of the application. I've highlighted the numbers I am interested in, but the eagle eyed among you might notice the other counters and wonder why they are there. Also note that these output displays are from MQEV's formatting out of Accounting records.

ACCTMQI(d:\nttools\q.exe)               EVSTREAM($ACCTMQI)  EVQMGR(MQG2)        INTVLSTA(2020-05-27 17:33:17 (Local))
INTVLEND(2020-05-27 17:33:22 (Local))   CONNID(414D51434D51473220202020202020205DF8CD5E01792D23)    PID(49560)
TID(3)              USERID(mqgemusr)    CHANNEL(MQGEM.SVRCONN)                  CONNAME(127.0.0.1)  RPRODUCT(MQCC)
RVERSION(09010000)  CONNTI(2020-05-27 17:33:17 (Local))     DISCTI(2020-05-27 05:33:22 (UTC))       CONNDURN(5)
SEQNUM(0)           RECORDS(1)          OPENQ(3)            OPENQM(1)           CLOSEQ(3)           CLOSEQM(1)
ALLPUT(3)           PUT1(3)             PUT1NP(3)           PUTBYTE(24)         PUTBYTENP(24)       COMMIT(1)
BACKOUT(1)          INQQM(1)

As you can see there are three counts where a queue was opened, three counts where a queue was closed, and three counts for PUT1.

One could make the case that there is some double accounting going on here to increment all three as a result of one MQ API call. However, if you look at the description of the "Put 1 Count" it says:-

The number of persistent and nonpersistent messages successfully put to a queue using MQPUT1 requests.

So this description is being quite specific that this is just a count of message putting, rather than being a count of the MQPUT1 verbs called. The description of the "Open Count" is a little less specific, when it says:-

The number of objects successfully opened.

and the description of the "Open Fail Count" is equally unspecific, when it says:-

The number of unsuccessful open object attempts.

But neither said that it was a count of the number of MQOPEN counts, just a count of the number of objects opened, and an MQPUT1 verb does an Open and a Put and a Close.

Example 2

Here's another example of an ACCTMQI record for an application that did 3 x MQPUT1 calls, where the last one failed because the queue was full.

ACCTMQI(d:\nttools\q.exe)               EVSTREAM($ACCTMQI)  EVQMGR(MQG2)        INTVLSTA(2020-05-27 17:49:00 (Local))
INTVLEND(2020-05-27 17:49:05 (Local))   CONNID(414D51434D51473220202020202020205DF8CD5E017F2D23)    PID(49560)
TID(9)              USERID(mqgemusr)    CHANNEL(MQGEM.SVRCONN)                  CONNAME(127.0.0.1)  RPRODUCT(MQCC)
RVERSION(09010000)  CONNTI(2020-05-27 17:49:00 (Local))     DISCTI(2020-05-27 05:49:05 (UTC))       CONNDURN(5)
SEQNUM(0)           RECORDS(1)          OPENQ(3)            OPENQM(1)           CLOSEQ(3)           CLOSEQM(1)
ALLPUT(2)           PUT1(2)             PUT1NP(2)           PUT1FAIL(1)         PUTBYTE(16)         PUTBYTENP(16)
COMMIT(1)           BACKOUT(1)          INQQM(1)

As you can see there are three counts where the queue was opened and closed, as in example 1, and two counts of PUT1 and one count of PUT1FAIL.

Example 3

And here's a third example of an ACCTMQI record for an application trying to use MQPUT1 on a queue that didn't exist.

ACCTMQI(d:\nttools\q.exe)               EVSTREAM($ACCTMQI)  EVQMGR(MQG2)        INTVLSTA(2020-05-27 17:48:09 (Local))
INTVLEND(2020-05-27 17:48:13 (Local))   CONNID(414D51434D51473220202020202020205DF8CD5E017E2D23)    PID(49560)
TID(8)              USERID(mqgemusr)    CHANNEL(MQGEM.SVRCONN)                  CONNAME(127.0.0.1)  RPRODUCT(MQCC)
RVERSION(09010000)  CONNTI(2020-05-27 17:48:09 (Local))     DISCTI(2020-05-27 05:48:13 (UTC))       CONNDURN(4)
SEQNUM(0)           RECORDS(1)          OPENQM(1)           OPENQFL(1)          CLOSEQM(1)          COMMIT(1)
BACKOUT(1)          INQQM(1)

Here there is just one count of an OPENQFL (Open Queue Failed) and no way to know if it happened as a result of an MQOPEN or an MQPUT1.

Counting MQI verbs

What if you need to figure out the counts of each MQI verb? Well, now that you know what the data is counting, you can calculate the verbs counts in many cases.

Verb to Count Calculation
Successful MQOPENs of queues OPENQ - (PUT1 + PUT1FAIL)
Successful MQCLOSEs of queues CLOSEQ - (PUT1 + PUT1FAIL)
Successful MQPUT1s PUT1

Unfortunately, there is no way to calculate counts for failing MQOPENs and failing MQPUT1s because all failing opens of objects, whether done as a result of an MQOPEN or an MQPUT1 are counted together in OPENQFL, so although you have a count of PUT1FAIL - the number of failing puts of messages using MQPUT1, there is no count of the number of failing opens of queues using MQPUT1.

Hopefully, this isn't something you need, and it is more important to understand just how many times queues were attempted to be opened and the operation failed, and which verb did it doesn't matter. If it does then raising an RFE would be the route to go.

The level of detail provided in the IBM MQ Accounting and Statistics is very granular, and I encourage everyone to spend some time delving deeper into this often untapped resource that your queue manager can be configured to emit.


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.

#mquirks
#IBMMQ
#ChampionsCorner
1 comment
24 views

Permalink

Comments

Wed May 27, 2020 08:45 AM

We also use the MQI open fail count to monitor our distributed MQ environment.  We collect and process all of our distributed MQI accounting data and subsequently produce a daily report of any open fails.  It is rare to have any open fails, so this data can be helpful in highlighting potential MQ application or configuration issues.