you should try to send in parallel.
Just use the jdk ExecutorService.

        ExecutorService executorService = Executors.newFixedThreadPool(10);
        executorService.equals(new Runnable() {

            @Override
            public void run() {
                // send in there
            }
        });

You might also want to use a pooling connection factory like the spring CachedConnectionFactory.

Christian


Am 25.10.2011 15:45, schrieb llt:
Hi,

I need to send a huge amount of JMS messages to my broker (activemq 5.5):
about 2.5 million messages.
I make some tests with camel, but the jms production is very slow and I
don't know if something is wrong in my implementation.

Using the old way I created a Session, Queue, MessageProducer ... and I can
send about 50.000 text messages in about 6 seconds.

So I tried with the camel way, but usually the same test takes from 120 to
140 seconds.

I tried two different approach:

1) direct send to my broker

ProducerTemplate producer = context.createProducerTemplate();
context.start();
for ( int i = 0; i<  50000; i++ ) {
     producer.sendBody("activemq:test.queue?deliveryPersistent=false",
String.format("Message %d", i));
}

2) send to a seda endpoint with more concurrent consumers and then to the
broker

context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
                from("seda:sendRequest?concurrentConsumers=50")
                .to("activemq:test.queue?deliveryPersistent=false")
                 ;
        }
});

for ( int i = 0; i<  50000; i++ ) {
     producer.sendBody("seda:sendRequest", String.format("Message %d", i));
}


I was hoping to get more benefits from seda, but the execution time was
almost the same.
Moreover with seda I have two side effects:
- My messages are quickly queued to seda exchanges list and with more
messages or more complex I need a larger heap
- I receive some warnings from the activemq broker:
  WARN  [org.apache.activemq.transport.failover.FailoverTransport] -
Transport (localhost/127.0.0.1:61616) failed to tcp://localhost:61616 ,
attempting to automatically reconnect due to: java.io.EOFException

I can use the old-way and it works, but I like camel! :-)
So what can I do to speed up my JMS production?

Thank you.

Ciao,
Lorenzo


--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-speed-up-JMS-production-tp4936275p4936275.html
Sent from the Camel - Users mailing list archive at Nabble.com.


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com

Reply via email to