Chapter 7. Generating Performance Benchmark Results

As we discussed in Chapter 1, Introducing JBoss Messaging, the key advantage of JBoss Messaging is its superior performance. In fact, the JBoss Messaging comes with a set of standard performance test. You can run them on your server and generate your own performance benchmark results. In this chapter, we will show you how to run a JBoss Messaging server and a JBossMQ server side-by-side on a single machine, and compare their performance. To get the performance tests, you have to obtain the JBoss Messaging source code from CVS as described in Chapter 3, Download Software.

The test consists in sending bursts of 1000 0 Kilobytes non-persistent messages to both JBoss Messaging and JBossMQ instances while gradually increasing the send rate (200 messages/sec, 400 messages/sec, etc) and measuring the receive rate. At the end, the framework generates the graph representing the receive rate as function of the send rate for two executions (JBoss Messaging and JBossMQ).

7.1. Run JBoss Messaging and JBossMQ Side-by-side

To run performance tests side-by-side on the same machine, we assume that you create two JBoss AS configurations with the JBoss Messaging and JBossMQ modules respectively. We assume that the JBoss Messaging module is installed in the server/messaging directory (see Chapter 5, Installation), and the default JBossMQ module is installed in server/jbossmq directory (just copy the original default directory that comes with the server).

Now, if you run the two configurations on the same server, there will be port conflicts. To avoid that, we use the JBoss ServiceBindingManager to increase the port numbers in the jbossmq configuration by 100 (i.e., the JNDI service will be available at port 1199 instead of 1099). To do that, un-comment the following line in server/jbossmq/conf/jboss-service.xml

<mbean code="org.jboss.services.binding.ServiceBindingManager"
       name="jboss.system:service=ServiceBindingManager">

  <attribute name="ServerName">ports-01</attribute>
  <attribute name="StoreURL">
    ../docs/examples/binding-manager/sample-bindings.xml
  </attribute>
  <attribute name="StoreFactoryClassName">
    org.jboss.services.binding.XMLServicesStoreFactory
  </attribute>
</mbean>
    

Now, you can start the messaging and jbossmq configurations side-by-side for testing.

run -c messaging
run -c jbossmq
    

7.2. Setup the Tests

The performance framework relies on distributed executors to send messages into the providers being tested. The executors can run standalone in their own VM and act as "remote" JMS connections, or colocated, in which case they are deployed as JBoss services and simulate "colocated" JMS connections.

In order to correctly deploy the colocated executors, the framework relies on the JBOSS_HOME environment variable. It assumes directories $JBOSS_HOME/server/messaging and $JBOSS_HOME/server/jbossmq exist.

cd perf
ant sar
ant start-executors
    

Next, we need to deploy test message destinations. They are in the messaging-destinations-service.xml, jbossmq-destinations-service.xml files. Feel free to add your own destinations (must add equivalent ones in both files) and then deploy them via the following command.

ant deploy-destinations
    

7.3. Configure Test Runs

The perf/perf.xml file is used to configure tests. In our setting (i.e., jbossmq runs in +100 port range from default), the <providers> section should look like the following. We can easily run the two JMS server configurations on different machines or in other port ranges. You just need to change the host and port numbers here for tests.

<provider name="JBossMessaging">
  <factory>org.jnp.interfaces.NamingContextFactory</factory>
  <url>jnp://localhost:1099</url>
  <pkg>org.jboss.naming:org.jnp.interfaces</pkg>
  <executor name="REMOTE" url="rmi://localhost:7777/standalone"/>
  <executor name="REMOTE2" url="rmi://localhost:7777/standalone2"/>
  <executor name="COLOCATED" url="rmi://localhost:7777/colocated-messaging"/>
  <executor name="COLOCATED2" url="rmi://localhost:7777/colocated-messaging2"/>
</provider>

<provider name="JBossMQ">
  <factory>org.jnp.interfaces.NamingContextFactory</factory>
  <url>jnp://localhost:1199</url>
  <pkg>org.jboss.naming:org.jnp.interfaces</pkg>
  <executor name="REMOTE" url="rmi://localhost:7777/standalone"/>
  <executor name="REMOTE2" url="rmi://localhost:7777/standalone2"/>
  <executor name="COLOCATED" url="rmi://localhost:7777/colocated-jbossmq"/>
  <executor name="COLOCATED2" url="rmi://localhost:7777/colocated-jbossmq2"/>
</provider>
    

The performance configuration section configures how to ramp up the load from 200 messages / sec to 3000 message / sec. We will gather statistics on the number of processed messages versus the number of sent messages.

<performance-test name="Throughput O KB Message
   Non-Persistent Non-Transactional, 1 sender, 1 receiver">

  <message-size>0</message-size>
  <messages>10000</messages>

  <drain/>

  <parallel>
    <send rate="200" executor="COLOCATED"/>
    <receive executor="COLOCATED2"/>
  </parallel>

  <parallel>
    <send rate="400" executor="COLOCATED"/>
    <receive executor="COLOCATED2"/>
  </parallel>

  <parallel>
    <send rate="800" executor="COLOCATED"/>
    <receive executor="COLOCATED2"/>
  </parallel>

  <parallel>
    <send rate="1000" executor="COLOCATED"/>
    <receive executor="COLOCATED2"/>
  </parallel>

  <parallel>
    <send rate="1500" executor="COLOCATED"/>
    <receive executor="COLOCATED2"/>
  </parallel>

  <parallel>
    <send rate="2000" executor="COLOCATED"/>
    <receive executor="COLOCATED2"/>
  </parallel>

  <parallel>
    <send rate="2500" executor="COLOCATED"/>
    <receive executor="COLOCATED2"/>
  </parallel>

  <parallel>
    <send rate="3000" executor="COLOCATED"/>
    <receive executor="COLOCATED2"/>
  </parallel>

  <execution provider="JBossMessaging"/>
  <execution provider="JBossMQ"/>

</performance-test>
    

7.4. Run the Tests

To run the tests, simply executes ant from the command line. You can access the benchmark result graphs from output/results/benchmark-results.html.

After running the test, you can clean up the executors and test destinations using the following commands.

ant kill-executors
ant undeploy-destinations