Inline On 30 July 2014 11:27, sarveswaran_m <sarveswara...@yahoo.com> wrote:
> We have a bunch of independent routes. > We run camel in stand-alone mode. > Ideally, we can run all our routes in a single camel context. > In such a scenario, a single greedy route consuming excess memory can bring > down the entire JVM. > There by, bringing all the routes down. > Is there any way this can be prevented in camel? > If there is a chance that a route brings the whole jvm down and you cannot afford any down time, your best option is to have another jvm to take over. Here are few ways to achieve master/slave configuration for camel routes [1] > > The alternate is to run each route in a separate context (in a separate > JVM, > as a separate process) > Is it a good idea to run each route as a separate process? > How does it compare with running multiple routes from a single context? > What is the trade-off? > First, having one camel context or multipe camel contexts is not very different as long as they are in the same JVM. Imagine having one or multiple spring contexts in a java app. Then having camel context in separate JVMs have the advantage of being in totally isolated process, but obviously that requires more resources in total. Also having the app split in separate processes is not enough if the interaction between these process is synchronous an if losing one JVM breaks the whole app. So you have to use something like activemq for the processes to interact in asynch and decoupled manner. > > Note: > We have tom-cat web container in our deployment environment. > Considering the 'greedy-route' scenario explained above, we are not > bundling > camel with tom-cat. > Is there any provision in tomcat that addresses the 'greedy-route' > scenario? > Probably one route per context is too granular. Usually I have around 4-5 routes per context. These routes work together, share the same resources, thread pools, lifecycle, error handlers. Also having written some good cohesive routes and endpoints externalized into properties files, means then you can try to different deployment scenarios, deploy all the context together, or split them by changing endpoints from direct-vm to activemq for example. One you reached this level, then there are tools such as fabric8 [2] which lets you easily manage and deploy your camel context in various containers standalone/tomcat/karaf, ensures that enough containers/JVMs are up and running... [1] http://www.ofbizian.com/2014/01/masterslave-failover-for-camel-routes.html [2] http://fabric8.io/gitbook/requirements.html HTH, -- > View this message in context: > http://camel.465427.n5.nabble.com/one-context-or-multiple-contexts-tp5754635.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Bilgin Ibryam Red Hat, Inc. Apache Camel & Apache OFBiz committer Blog: ofbizian.com Twitter: @bibryam <https://twitter.com/bibryam> Author of Instant Apache Camel Message Routing http://www.amazon.com/dp/1783283475