Itay Mendelawy is Product Manager at BlazeMeter. Prior to joining BlazeMeter, Itay was a Sysadmin and Devops consultant at Devops Israel, focusing on the development of agile and devops methodologies. Itay also spent several years as a programmer and integrator at Bank Hapoalim for CyberArk products designing and developing systems for secure server management. Itay began his career with 5 years as a Systems IT/Programmer in the Israeli Defense Forces.

Learn JMeter in 5 Hours

Start Learning
Slack

Test Your Website Performance NOW!

arrow Please enter a valid URL

Building a JMS Testing Plan - Apache JMeter

JMeter has three types of JMS samplers, that support two types of JMS testing, and in this article I will cover them.

 

The first thing that needs to be done is provide JMeter with a jar file containing the classes of which it will use to communicate with the MQ server. For this example I am using an ActiveMQ 5.9 as the MQ server, so in this case what I need to do is download the correct jar, and put it in JMeter’s lib directory, just like any other plugin. ActiveMQ does not have any backward compatibility, so in this case, I will have to download the exact version of the jar file (activemq-all-5.9.0.jar).

 

After setting the correct jar we can start JMeter, and set the JMS samplers.

JMS Point-to-Point sampler

This sampler provides a simple solution for Point-to-Point testing for Queues.

So just create a new Thread Group, and add a JMS Point-to-Point sampler

Most of the textboxes are well documented in JMeter’s community guide (https://jmeter.apache.org/usermanual/build-jms-point-to-point-test-plan.html). I will just elaborate on few issues.

 

After setting all of the values for the connection (Provider URL, Queue Connection Factory, Initial context Factory), as described in the documentation, you will have to configure the queues that the sampler will test. This is done using the JNDI properties, so what you need to do is create a JNDI property for each of the queues (response/request). In my ActiveMQ setup I have two queues:

  1. com.blazemeter.response
  2. com.blazemeter.request

For these queues I configured two JNDI properties like so:

After configuring the JNDI properties for the queues, it needs to be set in the JMS resources panel:

Also, in my MQ setup, an agent who is trying to connect to any JMS queue has to provide a username and password. In order to send the credentials to the MQ server, you need to add two new JNDI properties:

  1. java.naming.security.principal
  2. java.naming.security.credentials

And this is how it needs to be setup in the JNDI properties panel:

JMS Subscriber and JMS Publisher

The second way to test JMS queues is using the combination of JMS publisher and JMS subscriber samplers. These samplers, as their names suggests, are suitable for a Publisher-Subscriber scenario. Although using these samplers is better suited to test Topics, it’s also possible to test Queues using it.

 

Most of the configuration is well documented in JMeter’s documentation ( http://jmeter.apache.org/usermanual/component_reference.html#JMS_Subscriber for JMS subscriber, and http://jmeter.apache.org/usermanual/component_reference.html#JMS_Publisher for the publisher).

 

The only thing missing in the documentation is an explanation of how to configure the samplers to work with Queues or Topics. For both samplers the configuration is the same: In the 'Destination' text box, you need to add the correct prefix to the queue/topic name. If you want to subscribe to a Topic, than the prefix is: dynamicTopics/ and if it's a queue use dynamicQueues/.

 

For a queue:

  dynamicQueues/com.blazemeter.res

For a topic:

  dynamicTopics/com.blazemeter.res

For the JMS Subscriber sampler there is another step for the Queue/Topic configuration. We will need to set the function which the JMS subscriber uses. This is configured in the Client section:

For a queue: Use MessageConsumer.receive()

For a topic: Use Messagelistener.onMessage()

After setting the correct sampler for the test case, all you have to do is just save the script, and test on your local machine, and afterwards upload it to BlazeMeter to run with thousands of users.

 

     
arrow Please enter a valid URL

You might also find these useful:

Interested in writing for our Blog?Send us a pitch!

We're working on starting your first test

Testing 20 Virtual Users

Starting your test in around 2-4 minutes. Your report will appear once we've gathered the data.

0

Status: Preparing Your Test

Your email is required to complete the test. If you proceed, your test will be aborted.