This is an automated email from the ASF dual-hosted git repository. wangxin pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git
The following commit(s) were added to refs/heads/asf-site by this push: new 528736b fix typo (#292) 528736b is described below commit 528736b9da0a49a8237c2269561d0a642bc27808 Author: kezhenxu94 <kezhenx...@163.com> AuthorDate: Sun Feb 17 17:47:49 2019 +0800 fix typo (#292) --- docs/zh-cn/source_code_guide/loadbalance.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh-cn/source_code_guide/loadbalance.md b/docs/zh-cn/source_code_guide/loadbalance.md index d86f9bf..658ea3e 100644 --- a/docs/zh-cn/source_code_guide/loadbalance.md +++ b/docs/zh-cn/source_code_guide/loadbalance.md @@ -233,7 +233,7 @@ int weight = invoker.getUrl().getMethodParameter(invocation.getMethodName(), Con offsetWeight -= getWeight(invokers.get(leastIndex), invocation); ``` -问题出在服务预热阶段,第一行代码直接从 url 中去权重值,未被降权过。第二行代码获取到的是经过降权后的权重。第一行代码获取到的权重值最终会被累加到权重总和 totalWeight 中,这个时候会导致一个问题。offsetWeight 是一个在 [0, totalWeight) 范围内的随机数,而它所减去的是经过降权的权重。很有可能在经过 leastCount 次运算后,offsetWeight 仍然是大于0的,导致无法选中 Invoker。这个问题对应的 issue 为 [#904](https://github.com/apache/incubator-dubbo/issues/904),并在 pull request [#2172](https://github.com/apache/incubator-dubbo/pull/2172) 中被修复。具体的修复逻辑是将标注一处的代码修改为: +问题出在服务预热阶段,第一行代码直接从 url 中取权重值,未被降权过。第二行代码获取到的是经过降权后的权重。第一行代码获取到的权重值最终会被累加到权重总和 totalWeight 中,这个时候会导致一个问题。offsetWeight 是一个在 [0, totalWeight) 范围内的随机数,而它所减去的是经过降权的权重。很有可能在经过 leastCount 次运算后,offsetWeight 仍然是大于0的,导致无法选中 Invoker。这个问题对应的 issue 为 [#904](https://github.com/apache/incubator-dubbo/issues/904),并在 pull request [#2172](https://github.com/apache/incubator-dubbo/pull/2172) 中被修复。具体的修复逻辑是将标注一处的代码修改为: ```java // afterWarmup 等价于上面的 weight 变量,这样命名是为了强调该变量经过了 warmup 降权处理