Camel
  1. Camel
  2. CAMEL-5039

Make WeightedRandomLoadBalancer really random

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.10.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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.

      1. CamelLoadBalancerTest.java
        4 kB
        Xavier Fournet
      2. current-impl-result.txt
        4 kB
        Xavier Fournet
      3. new-impl-result.txt
        4 kB
        Xavier Fournet
      4. CamelLoadBalancerTest.java
        16 kB
        Xavier Fournet
      5. out.txt
        16 kB
        Xavier Fournet

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Ashwin Karpe
              Reporter:
              Xavier Fournet
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development