Monitoring queue statistics in MQ

When load testing MQ you are no doubt going to need to be able to monitor queue statistics in terms of how many messages have been enqueued and dequeued within a given timeframe. You can use native runmqsc commands to query queues in order to find current queue depths but this is just a snapshot in time. In order to be able to monitor how many messages have been or gone, you need to sample the queue over time. Here is a good synopsis of options…

A good way to achieve this is my using the PCF support package provided by IBM.

The WebSphere MQ Programmable Command Formats (PCF) provide the capability to perform administration tasks on a queue manager by sending and receiving WebSphere MQ messages of a special format. PCF request messages are sent to the queue manager’s command queue, where they are processed by the command server and replies returned to the designated reply-to queue.

This SupportPac contains a set of Java classes representing PCF header structures as well as an agent that can be used to simplify the task of communicating with a target queue manager and thus enable the use of WebSphere MQ Programmable Command Formats for queue manager administration.

Using a simple java object as documented in sample code, you can query queue stats of your choice. My implementation simply prints out the queue you are connected to, along with enqueue, dequeue and total queue size stats over an arbitrary time frame (eg. last 2 seconds). This can easily be called from a simple shell script.

Read More

A custom load harness for MQ Server

This is another blog in a similar vein to “No LoadRunner, No Problems” where I needed to write a custom test harness for MQ server. IBM kindly provide a complete Java API for getting in to the nitty gritty of MQ messages. Much can be learnt from WebSphere MQ sample code in Java and of course, if you ever get stuck in analyzing problems in your MQ setup you should always visit the MQSeries.net :: Index. Kevin Braithewaite wrote a really good harness that simplifies performance and stress testing with MQJavaRoundTrip. I have since written an extended version of this test harness that takes elements from many sources (including my own) and written a comprehensive test harness for MQ which is detailed in this post.

Read More