Highlighted
Visitor.
1896 views

Load Testing of MQ topic/subscriber

Hi,

In my current project, I need to load test one architecture consisting of event services which will publish messages to the MQ topic and there are subscriber applications which will listen to the topics and take action accordingly like sending notification or updating database. My question is what should be in scope of load testing for this arcitecture:

I have the services to send the messages to the MQ topics, but dont have any information how the subscriber application is listening to the topic assuming the call is asynchrnous in nature. Do we have any mechanism to test the subscriber funcationlity at all with loadrunner or we should restrict the testing of the publishing messages only? 

Any help will be highly appreciated

7 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Load Testing of MQ topic/subscriber

Hi,

Some very good references

Regards,

Shlomi

0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Load Testing of MQ topic/subscriber

On the implementation (scripts), there are two function to fetch the jms message from a queue or topic:

  • jms_receive_message_queue
  • jms_receive_message_topic

Practically, I faced a lot of issues with LR dealing with receiving messages off a queue or topic, they are inefficient and caused the whole test to queue up. Also, LR doesn't listen to queues, it just runs in iteration to check messages whereas in real life there are listeners subscribed to the topics/queues and it uses event based programming. I used an integration framework called, 'Apache Camel' to rid LR of the receiving responsibility. To implement this you will need the MQ driver for java and couple of lines of routing codes to receive the message and do what you want with it. You can link this with LR requests by using correlation ids. Receive time can be captured to come up with transaction processing time.

Tags (3)
Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..

Re: Load Testing of MQ topic/subscriber

Hi, Can you please share the details on the implementation of Apache Camel with Loadrunner. Even I am having difficulties in acheiving the Receive message from Queue. It would be of Great help. 

Email: Private Info Removed

0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Load Testing of MQ topic/subscriber


@Nagesh_command wrote:

Hi, Can you please share the details on the implementation of Apache Camel with Loadrunner. Even I am having difficulties in acheiving the Receive message from Queue. It would be of Great help. 

Email: nageshv.command@gmail.com


@Nagesh_command

I'll get back to you for sure but I need some time. I hope it isnt that urgent. Its been about a year since the implementation of that project, the code is lying somewhere in my old workstation. 

0 Likes
Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..

Re: Load Testing of MQ topic/subscriber

Sure, Please share me when you get time. Thanks for your response!!

--
Thanks,
Nagesh
Personal Info Erased

0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Load Testing of MQ topic/subscriber

@Nagesh_command

I cannot share the complete application with you due to confidential agreements but I can guide you in a direction to carry on, and sorry late reply.

The solution architecture -->

worddavdc027fa2b527984acb75bafa810873df.png

You will need a good understanding of how apache camel works (plenty of good documentation available). I read 'Camel in Action' by Manning Publications. I am going to put a sample code of how I achieved the basic routing logic. There were accompanying code to handle connections, contexts and components. Also, I supplied a data file with all the MQ or AMQ queue info which would be used by the camel application to initialize the connections. Hope you find this useful. Sorry, I couldn't give you the entire application.

import java.util.Properties;

import org.apache.camel.builder.RouteBuilder;

/**
 * A Camel Java DSL Router
 */
public class PSVTRouteBuilder extends RouteBuilder {

	private String qName;
	private String broker;
	private boolean debug;

	Properties props = new Properties();

	/**
	 * Default RouteBuilder for AMQ and WMQ
	 * @param qName - Name of the Queue
	 * @param broker - This should be either wmq or amq
	 */
	public PSVTRouteBuilder(String qName, String type) {
		super();
		this.qName = qName;
		this.broker = type;

		ComponentBuilder cb = new ComponentBuilder();
		debug = cb.getDebugState();
	}

	public void configure() {

		if(debug){

			from(broker+":queue:"+qName)
			.setHeader("corrIdInBody", xpath("//correlationId/text()"))
			.setHeader("businessServiceName", xpath("//businessServiceName/text()"))
			.setHeader("activityName", xpath("//activityName/text()"))
			.setHeader("msgType", xpath("//msgType/text()"))
			.setHeader("msgName", xpath("//msgName/text()"))
			.setHeader("communicationPattern", xpath("//communicationPattern/text()"))
			.setHeader("notificationType", xpath("//notificationType/text()"))
			.log("${header.corrIdInBody},${header.CorrelationID},${header.JMSCorrelationID},${header.JMSTimestamp},"
					+ "${date:now:yyyyMMdd-HHmmss.SSS},${header.businessServiceName},${header.activityName},${header.msgType},"
					+ "${header.msgName},${header.communicationPattern},${header.notificationType}").to("file:target/output/"+qName);

		}
		else{
			
			from(broker+":queue:"+qName)
			.setHeader("corrIdInBody", xpath("//correlationId/text()"))
			.setHeader("businessServiceName", xpath("//businessServiceName/text()"))
			.setHeader("activityName", xpath("//activityName/text()"))
			.setHeader("msgType", xpath("//msgType/text()"))
			.setHeader("msgName", xpath("//msgName/text()"))
			.setHeader("communicationPattern", xpath("//communicationPattern/text()"))
			.setHeader("notificationType", xpath("//notificationType/text()"))
			.log("${header.corrIdInBody},${header.CorrelationID},${header.JMSCorrelationID},${header.JMSTimestamp},"
					+ "${date:now:yyyyMMdd-HHmmss.SSS},${header.businessServiceName},${header.activityName},${header.msgType},"
					+ "${header.msgName},${header.communicationPattern},${header.notificationType}");

		}


	}

}
0 Likes
Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..

Re: Load Testing of MQ topic/subscriber

Thank you very much. Let me try this.

--
Thanks,
Nagesh

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.