[BUG] HOTSPOT mode with QPS throttling is unable to throttle or reject when QPS threshold is higher than 1000
YYX413 opened this issue · 0 comments
YYX413 commented
Issue Description
Type: bug report
Describe what happened
config1:
Resource: "single",
MetricType: hotspot.QPS,
ControlBehavior: hotspot.Throttling,
ParamIndex: 0,
Threshold: 1000,
DurationInSec: 1,
ParamsMaxCapacity: 500,
MaxQueueingTimeMs: 500
the sentinel log:
1693364333000|2023-08-30 10:58:53|single|1000|5341|1001|0|99|0|2|0
1693364334000|2023-08-30 10:58:54|single|999|5321|999|0|99|0|3|0
1693364335000|2023-08-30 10:58:55|single|1000|5421|1000|0|99|0|3|0
1693364336000|2023-08-30 10:58:56|single|1000|5331|1000|0|99|0|2|0
1693364337000|2023-08-30 10:58:57|single|1000|5621|1000|0|99|0|16|0
1693364338000|2023-08-30 10:58:58|single|1001|5131|1001|0|99|0|3|0
1693364339000|2023-08-30 10:58:59|single|1000|5221|1000|0|99|0|3|0
1693364340000|2023-08-30 10:59:00|single|998|5311|998|0|99|0|2|0
1693364341000|2023-08-30 10:59:01|single|1001|5221|1001|0|99|0|3|0
1693364342000|2023-08-30 10:59:02|single|1001|5421|1001|0|99|0|3|0
config2:
Resource: "single",
MetricType: hotspot.QPS,
ControlBehavior: hotspot.Throttling,
ParamIndex: 0,
Threshold: 1001,
DurationInSec: 1,
ParamsMaxCapacity: 500,
MaxQueueingTimeMs: 500
the sentinel log:
1693364268000|2023-08-30 10:57:48|single|7982|0|7979|0|0|0|100|0
1693364269000|2023-08-30 10:57:49|single|8061|0|8057|0|0|0|98|0
1693364270000|2023-08-30 10:57:50|single|7097|0|7104|0|0|0|100|0
1693364271000|2023-08-30 10:57:51|single|7580|0|7579|0|0|0|21|0
1693364272000|2023-08-30 10:57:52|single|7443|0|7440|0|0|0|36|0
1693364273000|2023-08-30 10:57:53|single|7055|0|7059|0|0|0|74|0
1693364274000|2023-08-30 10:57:54|single|6672|0|6672|0|0|0|100|0
1693364275000|2023-08-30 10:57:55|single|6803|0|6803|0|0|0|22|0
1693364276000|2023-08-30 10:57:56|single|6703|0|6703|0|0|0|21|0
Describe what you expected to happen
under config2 the sentinel behavior should be almost the same with config1
How to reproduce it (as minimally and precisely as possible)
- intervalCostTime := int64(math.Round(float64(batchCount * c.durationInSec * 1000 / tokenCount))) change the unit of interval time from milliseconds to nanoseconds might fix that problem
Tell us your environment
golang 1.19.4