camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Fournet (Commented) (JIRA)" <>
Subject [jira] [Commented] (CAMEL-5039) Make WeightedRandomLoadBalancer really random
Date Mon, 27 Feb 2012 23:59:48 GMT


Xavier Fournet commented on CAMEL-5039:

Hi Ashwin,

your pseudo code is quite similar with the mine I had attached before. The difference is in
the strict application of the round robin at each round or a statistical application of the
weights on a long number of execution.

I just notice that this is quite similar with the coding challenge recently proposed by Cedric
Beust, see

I used and adapted his method to check the randomness of the repartition. I also added some
stats on distances between the choice of the same processor.
I also worked on the round robin implementation that suffer the same kind of default

I have tested three random implementation:
* CurrentWeightedRandomLoadBalancer: the current camel random implentation
* NewStrictWeightedRandomLoadBalancer: a random algorithm with strict weight loadbalancing
at each turn (ie the one I had previously proposed)
* NewApproximateWeightedRandomLoadBalancer: a random algorithm with non-strict weight loadbalancing
at each turn (ie the one you propose if I had correctly implemented it)
and 2 two round robin implementation
* CurrentWeightedRoundRobinLoadBalancer: the current camel random implementation
* NewWeightedRoundRobinLoadBalancer: a new implementation that try to do a better loadbalacing
(ie avoid peak)

Results (the out.txt attachment has been created by using 2 14 3 1 weights as program arguments)
* every algorithm respect the weight (see last line of Distribution matrix)
* CurrentWeightedRandomLoadBalancer is clearly not random if we consider the criteria exposed
by Cedric (see Max of error and Average of error, both are in percentage)
* NewStrictWeightedRandomLoadBalancer and NewApproximateWeightedRandomLoadBalancer can be
considered random and performs equally in regards of this criterias. However considering the
standard deviations of the distances between two same choosen endpoint, the NewStrictWeightedRandomLoadBalancer
is doing a better job especially on routes with lowest weigths ie it minimize the risk of
* NewWeightedRoundRobinLoadBalancer do a better job for pure round robin but is not perfect.
I used a naive approach, may be someone could have better idea to implement it ? the goal
is to minize at the maximum the distance stddev

best regards,


> Make WeightedRandomLoadBalancer really random
> ---------------------------------------------
>                 Key: CAMEL-5039
>                 URL:
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Xavier Fournet
>            Assignee: Ashwin Karpe
>         Attachments:,, current-impl-result.txt,
new-impl-result.txt, out.txt
> As Mark Harwood explained in last comment of CAMEL-3197 the WeightedRandomLoadBalancer
is not doing a good load balancing job if some weight are a lot bigger than some other weight.
> See in the attached example (current-impl-result.txt), the first and third routes are
always called at the very beginning of every 50 iterations loadbalancing round.
> I propose a modified algorithm that do a more balanced loadbalancing (new-impl-result.txt)
> Attached the test program with the proposed implementation.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message