Sentinel icon indicating copy to clipboard operation
Sentinel copied to clipboard

流量未到限流阈值,出现拦截请求

Open furaul opened this issue 2 years ago • 2 comments

Issue Description

Type: bug report

Describe what happened (or what feature you want)

未到限流阈值,出现拦截请求。 限流预案配置 { "resource": "localLimitService", "limitApp": "default", "grade": 1, "count": 20, "strategy": 0, "controlBehavior": 0 }

压测配置: 40并发,该接口直接返回一个String,处理速度很快。

限流日志: 1660894141000|2022-08-19 15:29:01|localLimitService|20|40|20|0|1|0|0|0 1660894142000|2022-08-19 15:29:02|localLimitService|20|4|20|0|0|0|0|0 1660894143000|2022-08-19 15:29:03|localLimitService|20|304|20|0|0|0|0|0 1660894144000|2022-08-19 15:29:04|localLimitService|0|1|0|0|0|0|0|0 1660894187000|2022-08-19 15:29:47|localLimitService|2|0|2|0|1|0|0|0 1660894188000|2022-08-19 15:29:48|localLimitService|20|145|20|0|0|0|0|0 1660894212000|2022-08-19 15:30:12|localLimitService|20|436|20|0|0|0|0|0 1660894213000|2022-08-19 15:30:13|localLimitService|20|454|20|0|1|0|0|0 1660894218000|2022-08-19 15:30:18|localLimitService|20|2|20|0|0|0|0|0 1660894219000|2022-08-19 15:30:19|localLimitService|20|772|20|0|0|0|0|0 1660894236000|2022-08-19 15:30:36|localLimitService|20|32|20|0|0|0|0|0 1660894237000|2022-08-19 15:30:37|localLimitService|20|242|20|0|7|0|0|0 1660894240000|2022-08-19 15:30:40|localLimitService|20|208|20|0|0|0|0|0 1660894241000|2022-08-19 15:30:41|localLimitService|20|234|20|0|0|0|0|0 1660894245000|2022-08-19 15:30:45|localLimitService|21|376|21|0|0|0|0|0 1660894246000|2022-08-19 15:30:46|localLimitService|20|193|20|0|0|0|0|0 1660894247000|2022-08-19 15:30:47|localLimitService|22|345|22|0|0|0|0|0 1660894252000|2022-08-19 15:30:52|localLimitService|20|211|20|0|0|0|0|0 1660894253000|2022-08-19 15:30:53|localLimitService|20|362|20|0|0|0|0|0 1660894256000|2022-08-19 15:30:56|localLimitService|21|254|21|0|0|0|0|0 1660894257000|2022-08-19 15:30:57|localLimitService|20|300|20|0|0|0|0|0 1660894284000|2022-08-19 15:31:24|localLimitService|20|341|20|0|0|0|0|0 1660894285000|2022-08-19 15:31:25|localLimitService|20|187|20|0|8|0|0|0 1660894313000|2022-08-19 15:31:53|localLimitService|20|231|20|0|0|0|0|0 1660894314000|2022-08-19 15:31:54|localLimitService|20|355|20|0|1|0|0|0 1660894317000|2022-08-19 15:31:57|localLimitService|20|133|20|0|0|0|0|0 1660894318000|2022-08-19 15:31:58|localLimitService|20|299|20|0|1|0|0|0 1660894320000|2022-08-19 15:32:00|localLimitService|20|12|20|0|0|0|0|0 1660894321000|2022-08-19 15:32:01|localLimitService|21|405|21|0|0|0|0|0 1660894322000|2022-08-19 15:32:02|localLimitService|0|1|0|0|0|0|0|0 1660894324000|2022-08-19 15:32:04|localLimitService|20|393|20|0|0|0|0|0 1660894325000|2022-08-19 15:32:05|localLimitService|20|199|20|0|0|0|0|0 1660894344000|2022-08-19 15:32:24|localLimitService|20|106|20|0|0|0|0|0 1660894345000|2022-08-19 15:32:25|localLimitService|20|370|20|0|0|0|0|0 1660894346000|2022-08-19 15:32:26|localLimitService|0|1|0|0|0|0|0|0 1660894357000|2022-08-19 15:32:37|localLimitService|20|407|20|0|0|0|0|0 1660894358000|2022-08-19 15:32:38|localLimitService|21|331|21|0|0|0|0|0

在 [2022-08-19 15:29:04] [2022-08-19 15:32:02] [2022-08-19 15:32:26] 这几个时间点,出现了未到限流阈值的场景下,有拦截的流量,看起来像是限流逻辑窗口与指标写入窗口不完全重合?

Describe what you expected to happen

未到限流阈值,不应出现拦截请求。

How to reproduce it (as minimally and precisely as possible)

  1. 见前述小节。

Tell us your environment

mac os

Anything else we need to know?

Nothing.

furaul avatar Aug 19 '22 07:08 furaul

在这个时间点是否有其它的一些伴随现象(如严重 GC 或其他 unexpected behavior)?

sczyh30 avatar Aug 23 '22 11:08 sczyh30

在这个时间点是否有其它的一些伴随现象(如严重 GC 或其他 unexpected behavior)?

没有GC或者其他现象,这个是一个demo,只有几个很简单的Controller,处理逻辑也很简单。 我大致理了下滑动窗口相关代码,详情分析见下图,看看是否是该问题原因。 Sentinel滑动窗口 (1)

furaul avatar Aug 23 '22 13:08 furaul