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

Make WeightedRandomLoadBalancer really random

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.10.0
    • camel-core
    • None
    • 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. new-impl-result.txt
          4 kB
          Xavier Fournet
        3. current-impl-result.txt
          4 kB
          Xavier Fournet
        4. CamelLoadBalancerTest.java
          4 kB
          Xavier Fournet
        5. CamelLoadBalancerTest.java
          16 kB
          Xavier Fournet

        Issue Links

          Activity

            People

              akarpe Ashwin J. Karpe
              xfournet Xavier Fournet
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: