sathya_dev
sathya_dev

Reputation: 513

How to deploy same Camel routes in multiple server nodes for load balancing and fail over?

We're having some came routes defined in a single CamelContext which contains Web services,activemq.. in the Route.

Initially we've deployed the Routes as WAR in single Jboss node.

To scale out(usually we're doing for web services) , I've deployed the same CamelContext in multiple Jboss nodes.

But the performance is actually decreased.

FYI: All the CamelContexts points to the Same activemq brokers.

Here are my questions:

  1. How to load balance/ Fail over camel context in different machines?

  2. If CamelContexts are deployed in multiple nodes, Will aggregation work correctly?

Kindly give your thoughts!

Upvotes: 3

Views: 1945

Answers (1)

matt helliwell
matt helliwell

Reputation: 2678

Without seeing your system in detail, there is no way of knowing why it has slowed down so I'll pass over that. For your other two questions:

Failover

You don't say what sort of failover/load balancing behaviour you want. The not-very-helpful Camel documentation is here: http://camel.apache.org/clustering-and-loadbalancing.html.

One mechanism that works easily with Camel and ActiveMQ is to deploy to multiple servers and run active-active, sharing the same ActiveMQ queues. Each route attempts to read from the same queue to get a message to process. Only one route will get the message and therefore only one route processes it. Other routes are free to read subsequent messages, giving you simple load balancing. If one route crashes, the other routes will continue to process the messages, there will just be reduced capacity on your system.

If you need to provide fault tolerance for your web services then you need to look outside Camel and use something like Elastic Load Balancing. http://aws.amazon.com/elasticloadbalancing/

Aggregation

Each Camel context will run independently of the other contexts so one context will aggregate messages independently of what other contexts are up to. For example, suppose you have an aggregator that stores messages from ActiveMQ queue until receives a special end-of-batch message. If you have the aggregator running in two different routes, the messages will be split between the two routes and only one route will receive the end-of-batch message. So one aggregator will sit there with half the messages and do nothing. The other aggregator will have the other messages and will process the end-of-batch message but won't know about the messages the other route picked up.

Upvotes: 1

Related Questions