We have been doing performance testing of an application that uses IBM MQ. Through JMeter we are injecting the payload via a JMS Publisher. However, when running the test it can be observed that the connections from the JMeter threads are not being released. This effects the ability to reach the throughput and test failure due to the accumulation of threads. Is there a better alternative than using the JMS Publisher? Or is there setting there that needs to be enabled in order to release the connection once the request has been sent?
https://www.blazemeter.com/blog/ibm-mq-tutorial - Is this the best practice to implement testing IBM MQ?
What are you trying to achieve? JMeter implements Object Pool Pattern so each JMeter thread (virtual user) creates its own JMS connection and on subsequent iterations of the JMS Publisher sampler the Publisher object is being returned from the pool rather than created from zero.
If this is not something you want (or not how your JMS application acts) and you would like to close the connection after posting a message to queue/topic you can achieve it quite easily using JSR223 PostProcessor and the following Groovy code:
def publisher = sampler.publisher
org.apache.jmeter.protocol.jms.client.ClientPool.removeClient(publisher)
org.apache.commons.io.IOUtils.closeQuietly(publisher, null)
sampler.publisher = null
Related
I have to put messages in a queue for which I have all the connection details (host, port, channel, manager, queuename and username). I never worked on implementing JMeter for sending MQ. Can anyone let me know where can I get (blog or reference) step by step procedure to perform this? I tried referring to official site, can't really understand those JNDI, connection Factory settings
Man, your MQ statement is too general as there are too many possible message queue system providers like Apache ActiveMQ, RabbitMQ, IBM MQ, TIBCO, etc. and the values for all these JNDI/JMS properties, connection factory names, queue names, etc. will be different.
To get an overview of Java communication with "MQ" get familiarized with Getting Started with Java Message Service (JMS)
Download .jar files for your MQ system and put them to JMeter Classpath
Perform configuration as per your MQ system connection settings, example setup for Apache ActiveMQ is here: Building a JMS Testing Plan - Apache JMeter
I have multiple thread groups for pushing message to ActiveMQ using JMeter publisher sampler. My JMeter publisher sampler is configured with ActiveMQ failover URL. When I'm starting the JMeter it is pushing messages to both ActiveMQ irrespective of failover.
The sampler uses the ActiveMQ JNDI initial context factory (org.apache.activemq.jndi.ActiveMQInitialContextFactory)
The Provider URL: failover:(tcp://host1:61616,tcp://host2:61616)
The connection factory is simply the default one provided by ActiveMQ: ConnectionFactory.
The destination is the name of the JMS queue where we want to produce the message, prefixed with dynamicQueues: dynamicQueues/MyQueue.
As per Failover Transport documentation:
Using Randomize
The Failover transport chooses a URI at random by default. This effectively load-balances clients over multiple brokers. However, to have a client connect to a primary first and only connect to a secondary backup broker when the primary is unavailable, set randomize=false.
So my expectation is that when you run your test with multiple threads (virtual users) each thread sends message to the random broker.
If you want to target the first broker and use the second one only if the first one fails - consider appending ?randomize=false parameter to your failover URL like:
failover:(tcp://host1:61616,tcp://host2:61616)?randomize=false
More information just in case: Building a JMS Testing Plan - Apache JMeter
My Jmeter script has a JMS point-to-point sampler that sends JMS message to an ActiveMQ queue. During the load test we realized that the Jmeter connections to the AMQ were neither getting closed nor were re-used, hence causing connection leak and eventually the messages were refused by the broker. I do not see any option in the sampler to say re-use or close-connection. Whats the way I can achieve this? I would appreciate any alternative to using point to point as well, such as a java sampler which may help achieve the same result.
I expect the JMS connections created by Jmeter are re-used and avoid a connection leak. Any parameter similar to "KeepAlive" in http request available for JMS samplers?
point to point sampler config below
JMS Point to Point Sampler
I am a novice user for jmeter.
In my company i need to do load testing. I am using Hermes JMS to send request and response using the queues. So what should I use in jmeter, jms point to point or JMS publisher and subscriber. And I also want to set up the ftp location to get the files.
I tried both of those but getting the error in jndi properties:
"ERROR - jmeter.protocol.jms.sampler.JMSSampler: org.apache.activemq.jndi.ActiveMQInitialContextFactory javax.naming.NameNotFoundException: org.apache.activemq.jndi.ActiveMQInitialContextFactory"
I am not exactly sure how can I set up the queues that I am using in hermes.
How can I setup the JNDI settings? Or its default because I was reading online and everyone has Initial Context Factory as org.apache.activemq.jndi.ActiveMQInitialContextFactory and what about the queues do I need to provide my own queues or that's the default as well?
If you are using queues, you'll want to use JMS point to point. JMS publisher and subscriber uses JMS topics. If the queues already exist in ActiveMQ (and they appear to since you can see them in Hermes), you'll need to configure JMeter to use those. It sounds like your JNDI settings are incorrect and JMeter cannot find the JNDI name you're telling it to look for.
Regarding the 2nd part of your question: when using a JMS Publisher, you can use the dynamicQueues/ prefix for your destination when creating queues, dynamicTopics/ for topics, e.g. dynamicQueues/my.testqueue
You need to make sure that you have the 'activemq-all-[version].jar' file in the lib folder of JMeter so that when you set the 'Initial Context Factory' property to 'org.apache.activemq.jndi.ActiveMQInitialContextFactory' (as well as the 'QueueConnection Factory' resource to 'ConnectionFactory') in the JMS Sampler the latter is found and initiated by JMeter.
I've got a REST service that in response to a request, posts a message on a JMS queue. All of the main http functional testing is done using JMeter, so I was wondering if anyone has successfully pulled a JMS message off an existing queue in JMeter?
JMeter will do no such thing, but a class that you write to extend MessageListener, register with the queue, and have JMeter instantiate in a JUnit test certainly can. I'd recommend that you keep the consuming and testing separate. Write that MessageListener, get it working, and then figure out how to wire it into JMeter.