Sentinel icon indicating copy to clipboard operation
Sentinel copied to clipboard

[BUG] 高并发下SphO.entry(resourceName)方法占用cpu持续飙高,并且固定4秒才返回结果

Open sunwuxiang opened this issue 3 months ago • 5 comments

版本:1.4.1

配置: FlowRule paceRule = new FlowRule(); paceRule.setResource(resourceName); paceRule.setCount(distributeConfig.getQps().doubleValue()); paceRule.setGrade(RuleConstant.FLOW_GRADE_QPS); paceRule.setLimitApp("default"); paceRule.setControlBehavior(RuleConstant.CONTROL_BEHAVIOR_RATE_LIMITER); paceRule.setMaxQueueingTimeMs(distributeConfig.getQpsWaittingTime() * 1000); flowRules.add(paceRule);

使用: if (SphO.entry(distributeResourceName)) { //业务逻辑 return XXX; } //业务逻辑

现象: 请求量高,大约200多个线程左右并发,限流值:5,在半夜出现CPU持续飙高未打满,4核cpu达到3.18左右,然后就出现SphO.entry(resourceName)方法固定执行4秒钟,同时接口处的另一个SphO.entry方法固定执行2秒钟,的重启服务后恢复

环境: jdk 8,spring boot 1.5.8,spring 4.3.12,4核cpu3G

sunwuxiang avatar Sep 01 '25 07:09 sunwuxiang

设置的2秒wait时间,结果突然达到3秒多的处理时间,再之后就是4秒了,然后所有其他的限流请求都开始进入2秒钟的耗时等待,其实请求根本没达到sleep的量级,怀疑有时间泄露

sunwuxiang avatar Sep 10 '25 10:09 sunwuxiang

能否在1.8.8上做下验证

LearningGp avatar Sep 15 '25 12:09 LearningGp

我看这个版本要求jdk 17以上,我们的服务还是jdk8和11,还测不了。能否告知我大概是什么原因,在哪个提交修复的,我定位下,是不是因为fullgc啥的卡了下导致时间计算错误?

sunwuxiang avatar Sep 19 '25 08:09 sunwuxiang

@LearningGp 能否回复下

sunwuxiang avatar Sep 23 '25 06:09 sunwuxiang

1.8.8版本JDK8也能使用的哈,只是增加了JDK17和21的单测支持。版本差距过大,可能相关的改动比较多,现有的信息暂时无法定位,可以提供下临近出问题那段时间的metrics日志

LearningGp avatar Sep 28 '25 01:09 LearningGp