Wednesday, March 24, 2010

Load testing JBossESB with JMeter

Very simple example of applying a load on JBossESB via JMS, using jmeter. It does not really measure anythingis a simple way to write a large volume of messages to a JMS Queue. This sample only covers a request only (one way) scenario, but could be easily modified to load test a request/response servicem, measuring response time.

These steps assuming a working JBossESB install exists at $JBOSSESB.

Steps
  1. Define and verify a JBossESB service. The simplest case would be a gateway queue, an ESB queue, and a single action. Here is a sample jboss-esb.xml
  2. Download jmeter here: http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi
  3. Unpack and start to verify it works (start with jmeter.bat for win or jmeter for *nix)
  4. Add the required jars to your jmeter classpath. Locate your JBoss install. Copy the following files to your jmeter/lib/ext directory:
    • $JBOSSESB/server/default/lib/jboss-j2ee.jar
    • $JBOSSESB/server/default/lib/javassist.jar
    • $JBOSSESB/server/default/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar
    • $JBOSSESB/client/jbossall-client.jar
    • $JBOSSESB/client/jboss-messaging-client.jar
    • $JBOSSESB/client/trove.jar
    • $JBOSSESB/client/log4j.jar
  5. Create a new jmeter test plan. Add a thread group. Right click the thread group > Add > Sampler > JMS Point to Point.
  6. Edit the sampler:
    • QueueConnection Factory: "ConnectionFactory"
    • JNDI name Request queue: The name of your ESB service's gateway queue ("queue/someGatewayQueue")
    • Communication style: Request Only
    • Content: The contents of the message to be written to the queue
    • Initial Context Factory: org.jnp.interfaces.NamingContextFactory
    • Provider URL: jnp://localhost:1099 (adjust accordingly)
  7. Save the test plan.
  8. Adjust the Thread Group parms accordingly (thread count, iterations, etc) and run the test.