[Discussion] RandomLoadBalance optimize the same weight judgement
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
### Pre-check
- [X] I am sure that all the content I provide is in English.
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues.
### Apache Dubbo Component
Java SDK (apache/dubbo)
### Dubbo Version
Dubbo java 3.2, Open-JDK 1.8, Windows
### Steps to reproduce this issue
we judge if the weight is same after accumulation. It will cause us to do an additional addition operation. We can move the logic to determine if the weights are the same before accumulation. So we can reduce addition operation.
### What you expected to happen
We don't need to do an additional operation. It reduces performance
### Anything else
_No response_
### Are you willing to submit a pull request to fix on your own?
- [X] Yes I am willing to submit a pull request on my own!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
Contributor guide
Research direction
Start by locating the Java SDK's RandomLoadBalance implementation and the tests covering its weight calculation; no specific file or test is named in the issue. Review the weight-equality check and accumulation path, then verify that the optimization avoids the extra addition while preserving load-balancing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100