camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apara <ap...@standardset.com>
Subject Re: LoadBalancer seems to be doing some sort of throttling
Date Fri, 22 May 2015 04:02:01 GMT
So, it turns out that the processing of simple expressions is apparently
somewhat slow (my camel routes are currently handling 2300 events/second) so
each message is taking milliseconds to get through the pipelines.  If the
load balancing calculation takes too long it cannot keep the pipelines full.

I replaced the sticky(...) specification with my own code and things are
flying:

        .loadBalance(
            new QueueLoadBalancer() {
                @Override
                protected Processor chooseProcessor(final List<Processor>
processors, final Exchange exchange) {
                    //Get the partition key
                    //
                    final String
                        partitionKey =
                            exchange
                                .getIn()
                                .getBody(
                                    EventData.class
                                )
                                .getPartitionKey();

                    //Calculate the position
                    //
                    final int
                        size = processors.size(),
                        index = (partitionKey.hashCode() % size + size) %
size;

                    //Return the processor to use
                    //
                    return
                        processors
                            .get(
                                index
                            );
                }
            }
        )

It's amazing the kind of issues you start to find at these processing
speeds.  I am quite satisfied with Camel's raw processing speed when it
comes to core message routing.

-AP_




--
View this message in context: http://camel.465427.n5.nabble.com/LoadBalancer-seems-to-be-doing-some-sort-of-throttling-tp5767401p5767406.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message