Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make loadbalance robust, add comments #2962

Merged
merged 1 commit into from
Dec 17, 2018
Merged

Conversation

luchy0120
Copy link
Contributor

What is the purpose of the change

This patch can make random choose in LoadBalance more robust .

As the getWeight method in AbstractLoadBalance uses System.currentTimeMillis(),
so in the random choose stage of RandomLoadBalance ,the weight may change
as System.currentTimeMillis() will get new time stamp.

simplified a little bit code in LeastActiveLoadBalance

make getweight always return weight above zero

Also add comments for AbstractLoadBalance

Brief changelog

org.apache.dubbo.rpc.cluster.loadbalance.AbstractLoadBalance
org.apache.dubbo.rpc.cluster.loadbalance.RandomLoadBalance
org.apache.dubbo.rpc.cluster.loadbalance.LeastActiveLoadBalance
org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalance

Verifying this change

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@2fad342). Click here to learn what that means.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2962   +/-   ##
=========================================
  Coverage          ?   64.05%           
=========================================
  Files             ?      584           
  Lines             ?    26062           
  Branches          ?     4562           
=========================================
  Hits              ?    16694           
  Misses            ?     7186           
  Partials          ?     2182
Impacted Files Coverage Δ
...org/apache/dubbo/rpc/filter/ActiveLimitFilter.java 78.12% <ø> (ø)
...rpc/cluster/loadbalance/RoundRobinLoadBalance.java 87.69% <ø> (ø)
...o/rpc/cluster/loadbalance/AbstractLoadBalance.java 47.05% <0%> (ø)
...pc/cluster/loadbalance/LeastActiveLoadBalance.java 88.88% <100%> (ø)
...bbo/rpc/cluster/loadbalance/RandomLoadBalance.java 90% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fad342...a1305ef. Read the comment docs.

@beiwei30 beiwei30 merged commit a5faea2 into apache:master Dec 17, 2018
Codeprh added a commit to Codeprh/dubbo-go that referenced this pull request May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants