You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by hellocamel <su...@tcs.com> on 2016/02/17 13:00:16 UTC
Camel route ACtiveMQ to ActiveMq has low transactions per second
Hi this is my first camel example code. which works fine. but based on the
review on camel processing, i was expecting performance landing into 1000's
per second .
Instead i get very low TPS. is there something i can set to enhance it.
Thanks in advance for your help ppl.
public class MQ2MQ
{
public static void main(String[] args) throws Exception {
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
ActiveMQConnectionFactory connectionFactory2 = new
ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
CamelContext context = new DefaultCamelContext();
context.addComponent("test-jms2",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory2));
context.addComponent("test-jms",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from("test-jms:queue:test.queue?maxConcurrentConsumers=200&concurrentConsumers=100&asyncConsumer=false").threads(10).to("test-jms2:queue:test2.queue");
} });
context.start();
ProducerTemplate template = context.createProducerTemplate();
ConsumerTemplate consumer = context.createConsumerTemplate();
for (int i = 0; i < 10000; i++) {
template.sendBody("test-jms:queue:test.queue", "Test Message: " +
i);
}
}
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-route-ACtiveMQ-to-ActiveMq-has-low-transactions-per-second-tp5777819.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel route ACtiveMQ to ActiveMq has low transactions per
second
Posted by raffi <ra...@gmail.com>.
It's slow because you're creating/destroying connections repeatedly; you need
pooling:
PooledConnectionFactory connectionFactory =
new
PooledConnectionFactory("vm://mybroker?broker.persistent=false");
CamelContext context = new DefaultCamelContext();
context.addComponent(
"test-jms2",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
context.addComponent(
"test-jms"
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
Also, don't use *threads() * with /concurrentConsumer/, use the latter only.
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from(
"test-jms:queue:test.queue?concurrentConsumers=5&asyncConsumer=false")
.to("test-jms2:queue:test2.queue");
}
});
I was able to send thousands of messages in just a few seconds with those
optimizations alone,
Hope it helps
Raffi
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-route-ACtiveMQ-to-ActiveMq-has-low-transactions-per-second-tp5777819p5779820.html
Sent from the Camel - Users mailing list archive at Nabble.com.