3 Replies Latest reply on Jan 11, 2010 10:02 AM by Brian Gorrie

    Performance Testing HornetQ

    Brian Gorrie Newbie

      Hi,

       

      Has anyone done performance testing (or created a set of performance tests) of HornetQ?

       

      The reason I'm asking is that I am currently putting a set of performance tests together and don't want to reinvent the wheel if I can help it.

       

      As an FYI, here is my first pass at basic sending/recieving metrics (the percentages indicate X% of calls were less then or equal to the time).

       

      {code}

      [main] 09:53:37,188 INFO [org.hornetq.jms.tests.QueueTest]  [org.hornetq.jms.tests.QueueTest:Metrics:BaseQueueTestRecieve] [ 7121 ms ] 5000 @ 702.149 /sec, Avg: 0.611816 ms, Min: 0.440846 ms, Max: 10.611608 ms, Median: 0.536653 ms, Mode: 0.508169 ms @ 3 , 50%: 0.536652 ms, 75%: 0.577537 ms, 90%: 0.809641 ms, 95%: 0.987134 ms, 99%: 1.940366 ms
      [main] 09:53:37,195 INFO [org.hornetq.jms.tests.QueueTest]  [org.hornetq.jms.tests.QueueTest:Metrics:BaseQueueTestSend] [ 7128 ms ] 5000 @ 701.459 /sec, Avg: 0.788865 ms, Min: 0.54222 ms, Max: 120.14141 ms, Median: 0.640311 ms, Mode: 0.620933 ms @ 3 , 50%: 0.640302 ms, 75%: 0.688609 ms, 90%: 0.981365 ms, 95%: 1.171842 ms, 99%: 2.164544 ms
      [main] 09:53:43,850 INFO [org.hornetq.jms.tests.QueueTest]  [org.hornetq.jms.tests.QueueTest:Metrics:BaseQueueTestRecieve] [ 6663 ms ] 5000 @ 750.413 /sec, Avg: 0.588192 ms, Min: 0.439769 ms, Max: 6.518101 ms, Median: 0.535902 ms, Mode: 0.517335 ms @ 3 , 50%: 0.535901 ms, 75%: 0.572536 ms, 90%: 0.66436 ms, 95%: 0.905616 ms, 99%: 1.425827 ms
      [main] 09:53:43,855 INFO [org.hornetq.jms.tests.QueueTest]  [org.hornetq.jms.tests.QueueTest:Metrics:BaseQueueTestSend] [ 6669 ms ] 5000 @ 749.738 /sec, Avg: 0.720151 ms, Min: 0.541465 ms, Max: 10.521575 ms, Median: 0.640314 ms, Mode: 0.576738 ms @ 2 , 50%: 0.640309 ms, 75%: 0.680393 ms, 90%: 0.81478 ms, 95%: 1.150456 ms, 99%: 2.194207 ms

      {code}

       

      And here are the changes I made to the test case in the QueueTest class to produce the output.

       

      {code}

          /**
            * The simplest possible queue test.
            */
           public void testQueue() throws Exception {
               Connection conn = null;

               try {
                   conn = JMSTestCase.cf.createConnection();

                   Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
                   MessageProducer p = s.createProducer(HornetQServerTestCase.queue1);
                   MessageConsumer c = s.createConsumer(HornetQServerTestCase.queue1);
                   conn.start();

                   TextMessage textMessage = s.createTextMessage("payload");

                   String metricsIdSend = metrics.registerForMetricsLogging("BaseQueueTestSend", getClass());
                   String metricsIdRecieve = metrics.registerForMetricsLogging("BaseQueueTestRecieve", getClass());

                   for (int j = 0; j < 20; j++) {
                       for (int i = 0; i < 5000; i++) {
                           long startTime = System.nanoTime();
                           try {
                               p.send(textMessage);
                           } finally {
                               metrics.addTimeToMetrics(metricsIdSend, System.nanoTime(), startTime);
                           }
                           TextMessage m = null;
                           startTime = System.nanoTime();
                           try {
                               m = (TextMessage) c.receive();
                           } finally {
                               metrics.addTimeToMetrics(metricsIdRecieve, System.nanoTime(), startTime);
                           }
                           if (m != null) {
                               ProxyAssertSupport.assertEquals("payload", m.getText());
                           }
                       }
                       metrics.outputStatistics();
                   }

                   p.send(textMessage);
                   TextMessage m = (TextMessage) c.receive();
                   ProxyAssertSupport.assertEquals("payload", m.getText());

               } finally {
                   if (conn != null) {
                       conn.close();
                   }
               }
           }

      {code}

       

      Thoughts?

       

      Cheers,

       

      Brian.