develpoerX commented on a change in pull request #2192:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/2192#discussion_r556238241



##########
File path: 
handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestWeightedResponseTimeRuleExt.java
##########
@@ -73,10 +73,12 @@ public void testWeighed() {
       } else {
         server2.incrementAndGet();
       }
+      //此处是为了控制请求的时间窗口大小,使得策略中1分钟大小的时间窗口生效,并产生变化
+      Thread.sleep(1);

Review comment:
       答复:
   1.How about not adding this ? Can this test case pass?
   
如果不添加这个时间延时代码,测试模拟的2000次请求调用,会在很快时间内完成,大约是几秒钟就已经完成,使得采样结果还没有来得及更新,测试结果为50%,我注意到WeightedResponseTimeRuleExt策略中使用的时间窗口算法,平均值的上报更新时间间隔内,200次(按照目前设定2000次中10%会走前面的逻辑)模拟已经结束,无法模拟场景。
   2.Maybe it's better after this test case passed, and wait 1 secondes, and 
run the choose again, will give a distribution equal to 50%
   很好的建议,这里我已经添加了等待1分钟后,重新计算调用的次数,来观察,是否已经恢复。




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to