You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christian Müller <ch...@gmail.com> on 2012/12/05 22:22:40 UTC

Re: Seeing slow performance when placing messages onto JMS topic

Sorry for the delayed response. My inbox is a bit full...

I set up the following test with Camel 2.10.2:

public class CamelActiveMQTopicPerformanceTest extends CamelTestSupport {

    private int counter = 1000;
    private BrokerService broker;

    @Before
    public void setUp() throws Exception {
        broker = new BrokerService();
        broker.setPersistent(true);
        broker.setUseJmx(false);
        broker.addConnector("tcp://localhost:61616");
        broker.start();

        super.setUp();
    }

    @After
    public void tearDown() throws Exception {
        super.tearDown();

        broker.stop();
    }

    @Test
    public void test() throws InterruptedException {
        template.setDefaultEndpointUri("direct:start");

        long start = System.currentTimeMillis();
        for (int i = 0; i < counter; i++) {
            template.sendBody("test " + i);
        }
        long end = System.currentTimeMillis();

        System.out.println("sending " + counter + " messages tooks "+ (end
- start) + " ms");
    }



    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry registry = super.createRegistry();
        registry.bind("activemq",
ActiveMQComponent.activeMQComponent("tcp://localhost:61616"));
        return registry;
    }



    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:start")
                    .to("activemq:topic:test?deliveryPersistent=false");
            }
        };
    }
}

And got the log output: sending 1000 messages tooks 5968 ms
Which means less than 6ms per message. How did you measure the performance?
What number did you expect?

Best,
Christian

On Fri, Nov 16, 2012 at 7:07 PM, Edwin <ed...@gmail.com> wrote:

> ?deliveryPersistent=false
>