Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I improve the performance of a Seda queue?

Tags:

apache-camel

Take this example:

from("seda:data").log("data added to queue")
                  .setHeader("CamelHttpMethod", constant("POST"))
                  .setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
                  .process(new Processor() {
                      public void process(Exchange exchange) throws Exception {
                              exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
                      }
                   })
                  .recipientList(header(RECIPIENT_LIST))
                  .ignoreInvalidEndpoints().parallelProcessing();

Assume the RECIPENT_LIST header contains only one http endpoint. For a given http endpoint, messages should be processed in order, but two messages for different end points can be processed in parallel.

Basically, I want to know if there is anything be done to improve performance. For example, would using concurrentConsumers help?

like image 697
yalis Avatar asked Sep 05 '13 16:09

yalis


People also ask

What is a SEDA queue?

The staged event-driven architecture (SEDA) refers to an approach to software architecture that decomposes a complex, event-driven application into a set of stages connected by queues.

How does camel SEDA work?

It allows routes to be connected in an asynchronous way; that is, when a Camel route publishes a message to a seda: endpoint, the message is sent and control is returned immediately to the calling route. A SEDA consumer endpoint contains a buffer which is used to store the incoming messages.

What is SEDA component in camel?

The SEDA component provides asynchronous SEDA behavior, so that messages are exchanged on a BlockingQueue and consumers are invoked in a separate thread from the producer. Note that queues are only visible within a single CamelContext.

What is wiretap in camel?

Wire Tap from the EIP patterns allows you to route messages to a separate location while they are being forwarded to the ultimate destination.


1 Answers

SEDA with concurrentConsumers > 1 would absolutely help with throughput because it would allow multiple threads to run in parallel...but you'll need to implement your own locking mechanism to make sure only a single thread is hitting a given http endpoint at a given time

otherwise, here is an overview of your options: http://camel.apache.org/parallel-processing-and-ordering.html

in short, if you can use JMS, then consider using ActiveMQ message groups as its trivial to use and is designed for exactly this use case (parallel processing, but single threaded by groups of messages, etc).

like image 121
Ben ODay Avatar answered Oct 03 '22 14:10

Ben ODay