Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
[Dubbo-XXX] Fix UnknownException when host config not exist #XXX
. Each commit in the pull request should have a meaningful subject line and body.mvn clean install -DskipTests=false
&mvn clean test-compile failsafe:integration-test
to make sure unit-test and integration-test pass.