Skip to content

修正RoundRobin负载均衡方式的bug#14

Closed
zhouym06 wants to merge 6 commits intoapache:masterfrom
zhouym06:master
Closed

修正RoundRobin负载均衡方式的bug#14
zhouym06 wants to merge 6 commits intoapache:masterfrom
zhouym06:master

Conversation

@zhouym06
Copy link
Copy Markdown

修正weightSequence过快增长导致的高权重机器调用过多问题。
currentWeight本应为每轮加一,但原错写为每次调用加一。

设有两台机器权重分别为1和2,设计应为第一轮分别执行一次,第二轮在第二台执行一次。
但原算法为第一轮各有1/2的机会执行一次,第二轮在第二台执行一次。
造成高权重机器被调用次数过多。

修正为每次检查sequence完成一轮后才增加currentWeight。

@zhouym06
Copy link
Copy Markdown
Author

猜测作者可能是想让weightInvokers作为队列不断存储要调用的invoker,
但每次调用都清零 List weightInvokers = new ArrayList();
让未被调用的低权重机器失去了大量机会。

@zhouym06
Copy link
Copy Markdown
Author

orz,终于好了,之前手滑挪了文件夹位置……

@teaey
Copy link
Copy Markdown

teaey commented Mar 18, 2016

@teaey teaey closed this Mar 18, 2016
AlbumenJ added a commit that referenced this pull request Aug 26, 2024
AlbumenJ added a commit that referenced this pull request Aug 26, 2024
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.

2 participants