Search code examples
groovyjmeterjmsperformance-testingibm-mq

How can I measure the response (processing) times of a SuT using JMS Point-to-Point messaging model through IBM MQ?


I have a remote IBM MQ instance set up with 2 queues. Behind them is a System Under Test which always picks up messages put on the INBOUND.QUEUE" does some processing and places a response message on the "OUTBOUND.QUEUE".

I wish to test the response times of this SuT. To achieve this I need to put in place this scenario:

  • JMeter sends some message with ID1 to a queue named "INBOUND.QUEUE"
  • The System under test takes the message from "INBOUND.QUEUE", does some processing and places the response on "OUTBOUND.QUEUE"
  • JMeter checks and asserts that a response has been received for the message with ID1 on the queue named "OUTBOUND.QUEUE" within X seconds
  • View response time results in Aggregate Report Listener

In JMeter I have a setup very similar to the one described in this article, using JSR223 test elements with groovy code to interact with the IBM MQ Queues - through JMS, if my understanding is correct. The difference from the article is that in order to consume messages from the outbound queue, I have another setUp Thread Group which sets up another connection for the "OUTBOUND.QUEUE" from which I consume the messages and another tearDown Thread Group which closes this connection at the end.

On a high-level my setup looks like this: enter image description here enter image description here

It works so far, but it blindly consumes messages and I need to ensure that I'm reading (consuming) the response continuation of each initial message so that I may calculate the response or processing time of the SuT for each complete request-response flow. I understood that I can use JMS Correlation ID for this purpose but I don't know how.

  1. What method can I use to get this Correlation ID at message creation and consumption time?

  2. Do I need some data structure to put all the Correlation IDs at the message creation time so that I can put a condition like IF msg.getStringProperty("JMS_CorreationID") is IN list of produced ids, remove it from this data structure, then get the JMS_IBM_PUTTIME property to determine the timestamp for the "first" message, then finally calculate the timestamp delta between the current time and the time for the first message ?

  3. Once I would do this, how can I configure the JSR223 Sampler (Consumer) in the 2nd Thread Group via SampleResult class instance so it would report not its own execution time but the delta between JMS_IBM_PUTTIME and the current time (which would represent the processing time)?

  4. Finally, once this is done, how can I include into the load test report only this 2nd JSR223 Sampler (Consumer)?

Is this logic correct/too complex? Any help or some code examples would be greatly appreciated.


Solution

  • Normally you're supposed to be asking only one question in one post, I don't think anyone is willing to write a book to answer all the questions you have (and doing your job for you for free)

    1. If you want to use JMS Correlation ID you need to explicitly call Message.setJMSCorrelationID() function in the producer and correspondingly read it as Message.getJMSCorrelationID() in the consumer
    2. Yep, you can either use Inter-Thread Communication Plugin or props shorthand for JMeter Properties class instance
    3. You can use JSR223 PostProcessor, add it as a child of the JSR223 Sampler and use prev.elapsedTime = 123456, replace 123456 with the actual delta between sent and received message with the given correlation ID
    4. You can use SampleResult.setIgnore() function, this way the JSR223 Sampler where you call this function will neither be displayed in Listeners nor in .jtl results file.