You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by metebalci <me...@gmail.com> on 2011/12/12 17:55:32 UTC
seda queue performance
Hello,
I have a seda queue configured like from("seda:abc").loadBalance(5 bean
handlers)
Is it normal that camelContext.createProducerTemplate().sendBody("seda:abc",
payload) takes 0.5ms per message, e.g. 1000ms for 2000 messages ? Is there
any way to improve this ?
Thanks.
Mete
--
View this message in context: http://camel.465427.n5.nabble.com/seda-queue-performance-tp5068914p5068914.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: seda queue performance
Posted by metebalci <me...@gmail.com>.
Ok, so for my case, where I am not interested in anything returned from
seda, I think I can use asyncSendBody and discard the Future returned. I
will try that.
Mete
--
View this message in context: http://camel.465427.n5.nabble.com/seda-queue-performance-tp5068914p5072254.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: seda queue performance
Posted by Raul Kripalani <ra...@fusesource.com>.
Just to clarify, there seems to be some confusion regarding the usage of
sendBody/requestBody and variants.
The correct usage is as follows, pasted from the Wiki:
The send*() methods use the default Message Exchange Pattern (InOnly, InOut
> etc) as the endpoint. If you want to explicitly perform a request/response
> (InOut) you can use the request*() methods instead of the send*() methods.
i.e. to force InOut, use request*() methods. You can also use the async*()
variants if you want asynchronous request/reply.
Check out the full API doc at:
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/ProducerTemplate.html
Regards,
Raúl.
On 13 December 2011 09:52, Guillaume Yziquel <
guillaume.yziquel@crossing-tech.com> wrote:
> Le Tuesday 13 Dec 2011 à 01:30:10 (-0800), metebalci a écrit :
> >
> > Christian, you said sendBody uses InOut pattern, actually I only want
> InOnly
> > (only send, no need for return), how can I use it like that ?
>
> requestBody.
>
> http://camel.apache.org/producertemplate.html
>
> --
> Guillaume Yziquel
>
Re: seda queue performance
Posted by Guillaume Yziquel <gu...@crossing-tech.com>.
Le Tuesday 13 Dec 2011 à 01:30:10 (-0800), metebalci a écrit :
>
> Christian, you said sendBody uses InOut pattern, actually I only want InOnly
> (only send, no need for return), how can I use it like that ?
requestBody.
http://camel.apache.org/producertemplate.html
--
Guillaume Yziquel
Re: seda queue performance
Posted by metebalci <me...@gmail.com>.
Thanks Christian and Raul.
I am not much experienced on camel, so I may use wrong terminology, be aware
of this please.
More details:
I am using camel 2.6.0 at the moment with Sun Java 6 on Linux, and it runs
inside a war deployed on Tomcat 7.
I am configuring it programmatically with RouteBuilder (no xml).
code snippet -a summary-:
-- initialization code--
JndiContext jndiContext = new JndiContext();
CamelContext camelContext = new DefaultCamelContext(jndiContext);
camelContext.addComponent("mycomp0", new MyComp());
camelContext.addComponent("mycomp1", new MyComp());
LoadBalanceDefinition loadBalanceDefinition = new LoadBalanceDefinition();
loadBalanceDefinition = loadBalanceDefinition.roundRobin();
loadBalanceDefinition = loadBalanceDefinition.to("mycomp0:?someparamshere");
loadBalanceDefinition = loadBalanceDefinition.to("mycomp1:?someparamshere");
LoadBalancer loadBalancer = new RoundRobinLoadBalancer();
loadBalancer.addProcessor(loadBalanceDefinition.createProcessor(new
DefaultRouteContext(camelContext)));
from("seda:myqueue?concurrentConsumers=2").loadBalance(loadBalancer);
camelContext.start()
pt = camelContext.createProducerTemplate()
-- msg send code --
for (MyMessage myMessage : messages) {
pt.sendBody("seda:myqueue", myMessage);
}
So as Raul mentioned I figured out there is a concurrentConsumers parameter,
but I just started using it, not sure if it will change something.
Christian, you said sendBody uses InOut pattern, actually I only want InOnly
(only send, no need for return), how can I use it like that ?
Mete
--
View this message in context: http://camel.465427.n5.nabble.com/seda-queue-performance-tp5068914p5070902.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: seda queue performance
Posted by Raul Kripalani <ra...@fusesource.com>.
The Camel Context definition would help. Bear in mind that you can increase
concurrency at the consumer side by using the concurrentConsumers option on
the SEDA endpoint. Not sure if you have already come across that option?
Regards,
Raúl.
On 12 December 2011 18:43, Christian Müller <ch...@gmail.com>wrote:
> Hello Mete!
>
> sendBody(...) use the ExchangePattern#InOut. May your consumer slows down
> the route?
>
> It's easier to get if you provide the proper context for us (which Camel
> version do you use, some code snippets, ...). You can find more about it at
> [1].
>
> [1] http://camel.apache.org/support.html
>
> Best,
> Christian
>
> On Mon, Dec 12, 2011 at 6:12 PM, metebalci <me...@gmail.com> wrote:
>
> >
> > Thanks Claus, but I am already using it like that.
> >
> > e.g.
> >
> > ProducerTemplate pt = ...
> >
> > // this loop takes 1000ms for 2000 iterations
> > for (..) {
> > pt.sendBody(...)
> > }
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/seda-queue-performance-tp5068914p5068966.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
Re: seda queue performance
Posted by Christian Müller <ch...@gmail.com>.
Hello Mete!
sendBody(...) use the ExchangePattern#InOut. May your consumer slows down
the route?
It's easier to get if you provide the proper context for us (which Camel
version do you use, some code snippets, ...). You can find more about it at
[1].
[1] http://camel.apache.org/support.html
Best,
Christian
On Mon, Dec 12, 2011 at 6:12 PM, metebalci <me...@gmail.com> wrote:
>
> Thanks Claus, but I am already using it like that.
>
> e.g.
>
> ProducerTemplate pt = ...
>
> // this loop takes 1000ms for 2000 iterations
> for (..) {
> pt.sendBody(...)
> }
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/seda-queue-performance-tp5068914p5068966.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: seda queue performance
Posted by metebalci <me...@gmail.com>.
Thanks Claus, but I am already using it like that.
e.g.
ProducerTemplate pt = ...
// this loop takes 1000ms for 2000 iterations
for (..) {
pt.sendBody(...)
}
--
View this message in context: http://camel.465427.n5.nabble.com/seda-queue-performance-tp5068914p5068966.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: seda queue performance
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
See this FAQ
http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html
You should re-use the producer template, not create a new one for each message.
On Mon, Dec 12, 2011 at 5:55 PM, metebalci <me...@gmail.com> wrote:
>
> Hello,
>
> I have a seda queue configured like from("seda:abc").loadBalance(5 bean
> handlers)
>
> Is it normal that camelContext.createProducerTemplate().sendBody("seda:abc",
> payload) takes 0.5ms per message, e.g. 1000ms for 2000 messages ? Is there
> any way to improve this ?
>
> Thanks.
>
> Mete
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/seda-queue-performance-tp5068914p5068914.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/