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

SystemRule inbound QPS mode does not work well | 系统保护规则限制qps失败,通过successQps判断存在滞后性 #2450

Closed
wucheng1997 opened this issue Nov 17, 2021 · 3 comments · Fixed by #2455
Labels
kind/bug Category issues or prs related to bug.

Comments

@wucheng1997
Copy link
Contributor

增加模拟业务处理时间后会导致系统保护规则失败。该demo也无法限制住qps。

@sczyh30 sczyh30 added the kind/question Category issues related to questions or problems label Nov 19, 2021
@sczyh30
Copy link
Member

sczyh30 commented Nov 19, 2021

具体表现是?可否发一下当时的 metric log 看看,是否有达到阈值。

@wucheng1997
Copy link
Contributor Author

wucheng1997 commented Nov 20, 2021

参数配置如下,使用100个线程调用测试方法。

List rules = new ArrayList();
SystemRule rule = new SystemRule();
rule.setQps(30);
rules.add(rule);
SystemRuleManager.loadRules(Collections.singletonList(rule));

按照定义,此时应该能限制住qps为30,实际结果通过qps约等于130
贴上部分metric log日志如下

1637386848000|2021-11-20 13:40:48|methodA|118|1200|118|0|50|0|0|0
1637386848000|2021-11-20 13:40:48|total_inbound_traffic|118|1200|118|0|50|0|0|0
1637386849000|2021-11-20 13:40:49|methodA|130|2984|130|0|32|0|0|0
1637386849000|2021-11-20 13:40:49|total_inbound_traffic|130|2984|130|0|32|0|0|0
1637386850000|2021-11-20 13:40:50|methodA|114|3086|114|0|31|0|0|0
1637386850000|2021-11-20 13:40:50|total_inbound_traffic|114|3086|114|0|31|0|0|0
1637386851000|2021-11-20 13:40:51|methodA|128|3670|128|0|32|0|0|0
1637386851000|2021-11-20 13:40:51|total_inbound_traffic|128|3670|128|0|32|0|0|0
1637386852000|2021-11-20 13:40:52|methodA|125|4871|125|0|20|0|0|0
1637386852000|2021-11-20 13:40:52|total_inbound_traffic|125|4871|125|0|20|0|0|0
1637386853000|2021-11-20 13:40:53|methodA|127|4814|127|0|20|0|0|0
1637386853000|2021-11-20 13:40:53|total_inbound_traffic|127|4814|127|0|20|0|0|0
1637386854000|2021-11-20 13:40:54|methodA|129|4871|129|0|19|0|0|0
1637386854000|2021-11-20 13:40:54|total_inbound_traffic|129|4871|129|0|19|0|0|0
1637386855000|2021-11-20 13:40:55|methodA|128|4863|128|0|19|0|0|0
1637386855000|2021-11-20 13:40:55|total_inbound_traffic|128|4863|128|0|19|0|0|0
1637386856000|2021-11-20 13:40:56|methodA|126|4871|126|0|20|0|0|0
1637386856000|2021-11-20 13:40:56|total_inbound_traffic|126|4871|126|0|20|0|0|0
1637386857000|2021-11-20 13:40:57|methodA|123|4873|123|0|20|0|0|0
1637386857000|2021-11-20 13:40:57|total_inbound_traffic|123|4873|123|0|20|0|0|0
1637386858000|2021-11-20 13:40:58|methodA|122|4865|122|0|22|0|0|0
1637386858000|2021-11-20 13:40:58|total_inbound_traffic|122|4865|122|0|22|0|0|0
1637386859000|2021-11-20 13:40:59|methodA|129|4858|129|0|21|0|0|0
1637386859000|2021-11-20 13:40:59|total_inbound_traffic|129|4858|129|0|21|0|0|0
1637386860000|2021-11-20 13:41:00|methodA|127|4873|127|0|19|0|0|0
1637386860000|2021-11-20 13:41:00|total_inbound_traffic|127|4873|127|0|19|0|0|0

经排查发现SystemSlot是根据Constants.ENTRY_NODE.successQps()参数来判断qps是否超过阈值。而Constants.ENTRY_NODE.successQps()的赋值是在entry.exit()中实现的。所以会发生有业务处理延时时,限制不生效。观察普通的限流使用的是node.passQps()参数。修改成该参数后限流会变成30-40,会有轻微超过阈值。

@wucheng1997
Copy link
Contributor Author

参考pr修复 #2455 发现可以解决该问题。

@sczyh30 sczyh30 changed the title 系统保护规则限制qps失败 SystemRule inbound QPS mode does not work well | 系统保护规则限制qps失败,通过successQps判断存在滞后性 Nov 22, 2021
@sczyh30 sczyh30 added kind/bug Category issues or prs related to bug. and removed kind/question Category issues related to questions or problems labels Nov 23, 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

Successfully merging a pull request may close this issue.

2 participants