Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-5039

Make WeightedRandomLoadBalancer really random

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: 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.

        Attachments

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

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: