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

add new loadbalance strategy #6064

Merged
merged 3 commits into from
May 6, 2020
Merged

add new loadbalance strategy #6064

merged 3 commits into from
May 6, 2020

Conversation

Augustvic
Copy link
Contributor

@Augustvic Augustvic commented Apr 26, 2020

What is the purpose of the change

Add new loadbalance strategy based on response time.

Brief changelog

LeastActiveRoadBalance will not work properly when the performance of servers are quite different. The worst provider may have reached limit, then the best one may still free.

This strategy is much similar to the LeastActiveRoadBalance, but chooses response time of success calls instead of active connection.

We calculate the estimated response time from the product of active connection and succeeded average elapsed time, which means the time this call need to wait, and then choose the least one. If there are multiple invokers and the weights are not the same, then random according to the total weight. If there are multiple invokers and the same weight, then randomly called.

Verifying this change

ShotestResponseLoadBalanceTest shows that shortest estimated response invoker or first called invoker or zero active connection invoker will be choosen.

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Run mvn clean install -DskipTests=false & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

@codecov-io
Copy link

codecov-io commented Apr 26, 2020

Codecov Report

Merging #6064 into master will decrease coverage by 0.02%.
The diff coverage is 84.61%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #6064      +/-   ##
============================================
- Coverage     61.18%   61.15%   -0.03%     
+ Complexity      493      491       -2     
============================================
  Files           991      992       +1     
  Lines         39597    39636      +39     
  Branches       5719     5727       +8     
============================================
+ Hits          24227    24240      +13     
- Misses        12690    12710      +20     
- Partials       2680     2686       +6     
Impacted Files Coverage Δ Complexity Δ
...uster/loadbalance/ShortestResponseLoadBalance.java 84.61% <84.61%> (ø) 0.00 <0.00> (?)
...bo/config/event/listener/LoggingEventListener.java 37.50% <0.00%> (-25.00%) 0.00% <0.00%> (ø%)
...he/dubbo/common/threadpool/ThreadlessExecutor.java 52.17% <0.00%> (-10.87%) 0.00% <0.00%> (ø%)
...ava/org/apache/dubbo/config/DubboShutdownHook.java 63.82% <0.00%> (-10.64%) 0.00% <0.00%> (ø%)
.../remoting/transport/netty4/NettyServerHandler.java 59.09% <0.00%> (-9.10%) 0.00% <0.00%> (ø%)
...ng/transport/dispatcher/all/AllChannelHandler.java 62.06% <0.00%> (-6.90%) 0.00% <0.00%> (ø%)
.../org/apache/dubbo/remoting/ExecutionException.java 15.78% <0.00%> (-5.27%) 0.00% <0.00%> (ø%)
...e/dubbo/remoting/transport/netty/NettyChannel.java 55.68% <0.00%> (-4.55%) 20.00% <0.00%> (-1.00%)
...he/dubbo/remoting/transport/netty/NettyServer.java 70.17% <0.00%> (-3.51%) 8.00% <0.00%> (-1.00%)
...exchange/support/header/HeaderExchangeHandler.java 61.94% <0.00%> (-2.66%) 0.00% <0.00%> (ø%)
... and 13 more

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 e71ad15...5d42fa2. Read the comment docs.

Copy link

@superleo-cn superleo-cn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Approved.

@mercyblitz mercyblitz self-assigned this May 6, 2020
@mercyblitz mercyblitz added this to the 2.7.7 milestone May 6, 2020
@mercyblitz mercyblitz merged commit 6d2ba7e into apache:master May 6, 2020
vergilyn pushed a commit to vergilyn/dubbo-fork that referenced this pull request May 28, 2020
* add new loadbalance strategy

* add note

* Update ShortestResponseLoadBalanceTest.java

(cherry picked from commit 6d2ba7e)
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.

4 participants