You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by paveltumilovich <pa...@gmail.com> on 2013/08/01 08:19:54 UTC

Can multiple camel routes cause a very large number of threads?

Hello everyone.

I have a task to integrate two systems: a frontend serving html and backend
which gives data to frontend. Backend have a very large REST api so I have
to use multiple routes. I planned to use single camel context and wrap all
routes into it.

<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
    <from uri="direct:data"/>
    <to uri="ahc:http://localhost/data"/>
    
</camelContext>
Then, I planned to invoke the route using @Produce annotation on service
method as adviced in Hiding middleware article

public interface Service {
    String data();
}

public class MyBean {
    @Produce(uri = "direct:data")
    protected Service producer;

    public void doSomething() {
        // lets send a message
        String response = producer.data();
    }
}
As I understand information taken from here and here I'll end up with
additional 70 thread in my app (one for each route). I fear that it can
cause a serious performance hit and while the backend api will grow the
thread number will grow with it. Is it correct? How can I avoid this if it's
true? As I understand, I can't employ ExecutorService thread pool in this
case.

Thanks in advance for any answer.



--
View this message in context: http://camel.465427.n5.nabble.com/Can-multiple-camel-routes-cause-a-very-large-number-of-threads-tp5736620.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Can multiple camel routes cause a very large number of threads?

Posted by paveltumilovich <pa...@gmail.com>.
 Yes. Thank you, Claus.



--
View this message in context: http://camel.465427.n5.nabble.com/Can-multiple-camel-routes-cause-a-very-large-number-of-threads-tp5736620p5736628.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Can multiple camel routes cause a very large number of threads?

Posted by Claus Ibsen <cl...@gmail.com>.
Also posted here
http://stackoverflow.com/questions/17978163/can-multiple-camel-routes-cause-a-very-large-number-of-threads

On Thu, Aug 1, 2013 at 8:19 AM, paveltumilovich
<pa...@gmail.com> wrote:
> Hello everyone.
>
> I have a task to integrate two systems: a frontend serving html and backend
> which gives data to frontend. Backend have a very large REST api so I have
> to use multiple routes. I planned to use single camel context and wrap all
> routes into it.
>
> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>     <from uri="direct:data"/>
>     <to uri="ahc:http://localhost/data"/>
>
> </camelContext>
> Then, I planned to invoke the route using @Produce annotation on service
> method as adviced in Hiding middleware article
>
> public interface Service {
>     String data();
> }
>
> public class MyBean {
>     @Produce(uri = "direct:data")
>     protected Service producer;
>
>     public void doSomething() {
>         // lets send a message
>         String response = producer.data();
>     }
> }
> As I understand information taken from here and here I'll end up with
> additional 70 thread in my app (one for each route). I fear that it can
> cause a serious performance hit and while the backend api will grow the
> thread number will grow with it. Is it correct? How can I avoid this if it's
> true? As I understand, I can't employ ExecutorService thread pool in this
> case.
>
> Thanks in advance for any answer.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Can-multiple-camel-routes-cause-a-very-large-number-of-threads-tp5736620.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen