Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【bug】熔断降级的异常比例 与实际阈值不符 #109

Closed
aBreaking opened this issue Aug 30, 2018 · 1 comment
Closed

【bug】熔断降级的异常比例 与实际阈值不符 #109

aBreaking opened this issue Aug 30, 2018 · 1 comment
Labels
kind/bug Category issues or prs related to bug.

Comments

@aBreaking
Copy link

aBreaking commented Aug 30, 2018

Type: bug report
你好,我最近在整合Sentinel的一个项目中,发现设置的异常阈值,跟实际异常出现的比例并不符合。
就以官方的这个ExceptionRatioDegradeDemo为例子,在该例子中,根据产生异常的比例的代码片段:
if (count % 2 == 0) { // biz code raise an exception. throw new RuntimeException("throw runtime "); }
很明显,产生异常的比例就为50%了嘛。我将原代码中DegradeRule的阈值设为0.4。那么应该就会出现服务降级了吧?实际并没有。(不知道怎么上传图片,你们可以试试)。
就在这个demo中,后来经我反复调整阈值,发现异常产生比例为0.5时,阈值的临界值为0.33 。
同样的操作,发现异常产生的比例为0.25时,阈值的临界值为0.23.
异常产生的比例为0.33时,阈值的临界值为0.26。
异常比例为1时(即100%),阈值的临界值为0.50

不知是该demo的问题还是我本地测试的问题,烦请指教! 谢谢!
demo地址:https://github.com/alibaba/Sentinel/blob/master/sentinel-demo/sentinel-demo-basic/src/main/java/com/alibaba/csp/sentinel/demo/degrade/ExceptionRatioDegradeDemo.java

@aBreaking aBreaking changed the title 熔断降级的异常比例 与实际阈值不符 【bug】熔断降级的异常比例 与实际阈值不符 Aug 30, 2018
@CarpenterLee CarpenterLee added the kind/bug Category issues or prs related to bug. label Aug 31, 2018
@CarpenterLee
Copy link
Contributor

Thanks for your patient test. This bug is cause by misusage of ClusterNode.successQps() in DegradeRule.passCheck() method, we will fix it soon.

sczyh30 pushed a commit that referenced this issue Sep 19, 2018
Arlmls pushed a commit to Arlmls/Sentinel that referenced this issue Jan 8, 2019
CST11021 pushed a commit to CST11021/Sentinel that referenced this issue Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Category issues or prs related to bug.
Projects
None yet
Development

No branches or pull requests

2 participants