How to only flow control on some origin when total QPS up to the rule's setting
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
Type: *feature request*
### Describe what happened (or what feature you want)
It's about Flow Control. Thinking of the following case:
One resource A could accept 10 QPS, it has three origin: B, C, D. If A receives B request in QPS 20 at one moment, and at the same time the QPS of C and D is just low, such as 1. This case, we want to limit B's request, because B's requests are not normal, but not limit C and D's requests cause they are normal requests, if we just add a rule about resource A that limit QPS to 10, we may limit C and D's requests, that's not we expect.
Maybe we could add more rules:
rule1: A with limitApp='default' to limit QPS to 10
rule2: A with limitApp='B' to limit QPS to suitable value, such as 6
rule3: A with limitApp='C' to limit QPS to 5
rule4: A with limitApp='D' to limit QPS to 4
According the above rules, when B,C,D's QPS are seperately 20, 1, 1, sentinel will limit B,C,D's QPS to 6, 1, 1, and this total is 8 that will low the system load(beacase the resource's limit is QPS 10). Maybe we could modify rule2's QPS to 8, thus the resource's load could be QPS 10. But consider this case: B,C,D's QPS are seperately 7, 2, 2, they are greater than total QPS 10, and not satisfy rule2-4, so sentinel will just using the total limit 10, and limit B,C,D's QPS to 7, 1, 2 or 6, 2, 2 or so on, and this limitation is not in our expectation, our expections are when some origin's QPS up to some value, sentinel should only limit this origin, and after limitation, the tatol QPS should as high as possible.
I mean if we use the above method, the value of QPS in rule2 may very hard to set, if set too low, the total QPS may not up to highest, if set too high, maybe the requirement that only limits some unnormal origin may not satisfy.
Anyone has a good idea?
### Describe what you expected to happen
### How to reproduce it (as minimally and precisely as possible)
1.
2.
3.
### Tell us your environment
### Anything else we need to know?
Contributor guide
Research direction
No files, tests, or entry points are mentioned. Start by tracing Sentinel's flow-control handling for origin-specific rules and compare the B/C/D traffic cases described in the issue. Done means the expected behavior is agreed and covered for selective origin limiting without unexpected total-QPS throttling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100