Processing Accounting and Statistics data for WMB

Introduction:
Accounting and statistics data in WMB will help us to get the performance metrics of the message flow such as number of threads, max time to process a message, message max size, CPU utilization, product performance, how many messages processed etc. These data can be taken in a granular level (node level) as well. Data can be captured for a defined duration to analyse the performance metrics.
Accounting and statistics data can be captured using WMB explorer or by commands. And the data captured can be viewed in granular/tabular form via WMB explorer.

The performance impact is minimal when collecting these data with basic level. But when we capture advanced level (Node level) details, performance impact may occur.

Challenges:
Collecting and viewing the statistics via WMB (MQ) explorer may not provide the results properly as it may hang for some time or user interruptions are required to save the metrics, pause, stop etc in the WMB explorer. When administrating a remote broker, it may be too slow to display the snapshot data in the explorer.

Solution:
To overcome these, we can capture the accounting data using the command line utilities. By using the commands, we can capture either snapshots (every 20 secs emitted) or archives (every 60 mins by default) accounting info.
By default the archive interval is 60 min. However it can be changed by mqsichangebroker command
Eg:

mqsichangebroker  -v statisticsMajorInterval

Where statisticsMajorInterval is integer values represents minutes (minimum1, max: 43200)
For the performance testing, it is recommended collecting the archive data since it can capture the details for a duration like 60 min to get a more realistic performance metrics.

The below steps are to catch the accounting and statistics data in archive mode. We can collect the data either in XML format or in user trace. Here we are collecting the statistics in XML format.

To Capture the accounting and statistics data in XML format, need to do the below setup:
Create a local queue to capture the data:

define ql(ACCOUNTINGDATA_DEFAULT)

Create a subscription for the topic to the queue created above:

Topic string:

 $SYS/Broker/WBIBROKER8/StatisticsAccounting/Archive/default/# 

Here, WBIBROKER8 is the Broker name
‘Archive’ is to collect the archive data. (other option is SnapShot. Use wildcard ‘+’ if you want to subscribe both)
default is the ex group name
‘#’ is a wild card entry for MQ subscription (to subscribe all flows in the ex group)

Subscription command is as below:

DEFINE SUB('MsgFlowAccounting_Sub') + 
       TOPICSTR('$SYS/Broker/WBIBROKER8/StatisticsAccounting/Archive/default/#') +
       TOPICOBJ('') +
       DEST('ACCOUNTINGDATA_DEFAULT') +
       DESTQMGR('MB8QMGR') +
       PUBAPPID('') +
       SELECTOR('') +
       USERDATA('') +
       PUBACCT(0000000000000000000000000000000000000000000000000000000000000000) + 
       DESTCORL(000000000000000000000000000000000000000000000000) +
       DESTCLAS(PROVIDED) +
       EXPIRY(UNLIMITED) + 
       PSPROP(MSGPROP) + 
       PUBPRTY(ASPUB) +
       REQONLY(NO) + 
       SUBSCOPE(ALL) + 
       SUBLEVEL(1) + 
       VARUSER(ANY) +
       WSCHEMA(TOPIC) +
       REPLACE

Now run the below commands to activate the accounting and statistics in the ex group level:
To activate:

mqsichangeflowstats WBIBROKER8 -a -e default -j  -c active -t basic -o xml –r

To Disable:

mqsichangeflowstats WBIBROKER8 -a -e default -j  -c inactive -t basic -o xml –r

To check the current settings:

mqsireportflowstats WBIBROKER8 -s -a -e default –j

By default, the archival interval is 60 mins. We can change this interval by issuing the mqsichangebroker command (broker should be stopped in order to execute this command).

mqsichangebroker WBIBROKER8 -v 30 

The above command will change the arcive interval to 30 mins.
So the accounting and statistics message will be published on every archival interval expires or in case of:
Execution group restarted or Broker restarted.

Appendix:
The XML data published can be better formatted (in tabular form) using a simple message flow and DFDL combination. This utility flow will have a data model written in DFDL to serialize the accounting data as CSV format (which can be read by Excel).

Bar File is attached as below:

Edit the BAR file and configure the properties according to the deployment environment:
Bar_file_accountingdata

This utility flow will read the XML messages from the subscription queue and will convert the data in to CSV format and write that to an output file directory (local).

The Source Code PI is available here

This entry was posted in IBM Integration Bus, WMB and tagged , , , , , , , . Bookmark the permalink.

Leave a comment