apache / apache/dubbo-website

A beggar's version of weight round robin load balance -_-

Open
#2,879 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
491
Forks
809
Avg merge
1d 6h
Merged PRs (30d)
6

Description

## Describe the proposal
```
public class WeightRoundRobinLoadBalance implements LoadBalance {
private int totalWeight = 0;
private final List serverNodeList;

public WeightRoundRobinLoadBalance(List serverNodeList) {
this.serverNodeList = serverNodeList;
serverNodeList.forEach(p -> totalWeight += p.getWeight());
}
@Override
public ServerNode getServer() {
ServerNode result = serverNodeList.stream()
.peek(serverNode -> serverNode.addCurrent(serverNode.getWeight()))
.max(Comparator.comparingInt(ServerNode::getCurrent)).get();
result.subtractCurrent(totalWeight);
return result;
}
}
public class ServerNode {

private String ip;

private Integer weight = 1;

private Integer current = 0;

public ServerNode(String ip) {
this.ip = ip;
}

public ServerNode(String ip, Integer weight) {
this.ip = ip;
this.weight = weight;
}

public void addCurrent(int addNum){
this.current += addNum;
}
public void subtractCurrent(int addNum){
this.current -= addNum;
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue includes Java implementations for WeightRoundRobinLoadBalance and ServerNode, but names no repository files, tests, or entry points. Start by locating the relevant load-balancing documentation or examples in dubbo-website, then clarify the intended scope and acceptance criteria for the weighted round-robin proposal.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.