alibaba / alibaba/Sentinel

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

Open
#2,839 2 comments 0 reactions 0 assignees View on GitHub
kind/question
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

## 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.

Contributor guide

Open the contributing guide

Research direction

Start with the localLimitService configuration and the recorded rate-limit log entries, then reproduce the reported 40-concurrent-request test on macOS. Compare rejection timestamps with the configured threshold and metric-writing window. Done means the cause is identified and the behavior is corrected or clearly documented with a reproducible test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.