Tuesday, October 7, 2014

Performance Testing with A-MQ

I have been asked alot about JBoss A-MQ performance and metrics. Metrics can vary depending upon many factors such as configuration, hardware, message size, number of messages, etc. Instead of publishing specific numbers I thought I would share Samples and Test Plans so that you can test in your own environment.

Server Setup

Fuse 6 Installation and Setup

● Download Fuse 6 from http://www.jboss.org/products/fuse and copy the contents to any directory. Throughout the rest of these instructions, this newly created fuse directory will be represented as <fuse_directory>

● Download the latest AMQ-Testing release from https://github.com/FuseServiceWorksByExample/AMQ-Testing/releases and extract the activemq.xml file into the <fuse_directory>/etc folder

Client Setup

Test Directory Creation

● Create a new directory to contain all test plans, tools, and results. Throughout the rest of these instructions, this new test directory will be represented as <test_directory>.
Downloading the Samplers and Test Plans

● Download the latest AMQ-Testing release from https://github.com/FuseServiceWorksByExample/AMQ-Testing/releases and extract all folders in the release file into <test_directoy>

Building the Samplers

● Build the samplers.

    > cd <test_directory>/samplers
    > mvn

Apache JMeter Installation and Setup

● Download Apache Jmeter from http://jmeter.apache.org/download_jmeter.cgi

● Unzip the downloaded archive to <test_directory>/apache-jmeter

● Prepare the JMeter lib directory

    ○ Download the latest mqtt-client jar from http://mvnrepository.com/artifact/org.fusesource.mqtt-client/mqtt-client and put it in the <test_directory>/apache-jmeter/lib folder

    ○ Download the latest hawtdispatch-transport jar from http://mvnrepository.com/artifact/org.fusesource.hawtdispatch/hawtdispatch-transport and put it in the <test_directory>/apache-jmeter/lib folder

    ○ Download the latest hawtdispatch jar from http://mvnrepository.com/artifact/org.fusesource.hawtdispatch/hawtdispatch and put it in the <test_directory>/apache-jmeter/lib folder

    ○ Download the latest hawtbuf jar from http://mvnrepository.com/artifact/org.fusesource.hawtbuf/hawtbuf and put it in the <test_directory>/apache-jmeter/lib folder

    ○ Download the latest activemq-client jar from http://mvnrepository.com/artifact/org.apache.activemq/activemq-client and put it in the <test_directory>/apache-jmeter/lib folder

● Prepare the JMeter ext directory

    ○ Copy the sampler jars that were built in the section entitled “Building the Samplers” from their respective target directories to the JMeter ext directory

    > cp <test_directory>/jms_consumer/target/ApacheJMeter_jms_consumer.jar <test_directory>/apache-jmeter/lib/ext
    > cp <test_directory>/jms_producer/target/ApacheJMeter_jms_producer.jar <test_directory>/apache-jmeter/lib/ext
    > cp <test_directory>/mqtt_consumer/target/ApacheJMeter_mqtt_consumer.jar <test_directory>/apache-jmeter/lib/ext
    > cp <test_directory>/mqtt_consumer/target/ApacheJMeter_mqtt_producer.jar <test_directory>/apache-jmeter/lib/ext


Running the Tests

The processes involved in running these tests are very similar from one test to the next. Therefore, the steps below provide an example by outlining the processes involved in running one of the tests. In the example test, one JMS client publishes messages to a virtual topic while another JMS client consumes those messages from an associated queue.

● Start the Fuse 6 server

    ○ > <fuse_directory>/bin/fuse

● Configure the broker URLs in the test plan

    ○ Start the JMeter GUI

■ > <test_directory>/apache-jmeter/bin/jmeter

    ○ Open the test plan

■ File -> Open -> <test_directory>/test_plans/JMS_1x1_VT/TestPlan.jmx

    ○ Select the root node of the test plan from the tree view on the left side of the interface

    ○ Change the value associated with the brokerUrl User Defined Variable to the IP address of the server

    ○ Save the test plan

■ File -> Save

    ○ Close the JMeter GUI

● Run the test from the client command line

    ○ > JVM_ARGS="-Xmx1024m -Xms1024m" <test_directory>/apache-jmeter/bin/jmeter -n -l <test_directory>/results.jtl -j ./log.txt -t <test_directory>/test_plans/JMS_1x1_VT/TestPlan.jmx

Viewing the Results

The test results will be written to the file named results.jtl in <test_directory>. Once the test exits, open the JMeter GUI again, select the root node of the default/empty test plan and select add -> listener -> Aggregate Graph. On the Aggregate Graph configuration screen, click the browse button and open the results.jtl file that was generated by the test. The aggregate throughput values will appear - multiply the consumer throughput value by 1000 (there are 1000 messages per batch) to obtain a throughput estimate. Other listeners can be used to further analyse results.

After Each Test

● Stop the Fuse service

    ○ ctrl-d

● Delete the Fuse data directory

    ○ > rm -rf <fuse_directory>/data