-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flow control by frequent (hot spot) parameters #156
Conversation
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Use `ConcurrentLinkedHashMap` library directly Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #156 +/- ##
============================================
+ Coverage 50.01% 51.49% +1.47%
- Complexity 690 878 +188
============================================
Files 122 141 +19
Lines 4213 5166 +953
Branches 577 770 +193
============================================
+ Hits 2107 2660 +553
- Misses 1867 2207 +340
- Partials 239 299 +60
Continue to review full report at Codecov.
|
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
c0e60d7
to
7b4acd5
Compare
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
7b4acd5
to
b24f5ff
Compare
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Add callback registry for statistic slot for extensions. - Add a new module `sentinel-parameter-flow-control` under `sentinel-extension`. - Add a `CacheMap` interface to provide abstraction for cache. We use ConcurrentLinkedHashMap as the default implementation (LRU strategy).. - Add a `ParameterMetric` class as frequent parameter metrics for a specific resource. The metric map is located in `ParamFlowSlot` rather than `ClusterNode`. - Implement `ParameterLeapArray` as statistic data structure for frequent parameters in a period of time window. - Add `ParamFlowSlot` as the checker slot; Add `ParamFlowChecker` to do rule checking; Add `ParamFlowRuleManager` to do rule managing. - The statistic metrics for frequent parameters is enabled only if the related resource has configured parameter flow rule; Parameter metrics for removed rules will be cleared automatically. - Leverage extensible `SlotChainBuilder` to provide a `HotParamSlotChainBuilder`. - Add command handlers for hot param rules. - Add test cases and demo.
Describe what this PR does / why we need it
In some circumstances, users may want to do flow control by frequent (hot spot) parameters. For example:
userId
as parameter, limit top-frequent usersproductId
as parameter, limit invocations on relevant services for top-N productsLike normal flow control, flow control by frequent parameters support two mode: QPS (default) and thread count.
Does this pull request fix one issue?
Closes #32
Describe how you did it
sentinel-parameter-flow-control
undersentinel-extension
CacheMap
interface to provide abstraction for cache. We use ConcurrentLinkedHashMap as the default implementation (LRU strategy).ParameterMetric
class as frequent parameter metrics for a specific resource. The metric map is located inParamFlowSlot
rather thanClusterNode
ParameterLeapArray
as statistic data structure for frequent parameters in a period of time windowParamFlowSlot
as the checker slot; AddParamFlowChecker
to do rule checking; AddParamFlowRuleManager
to do rule managingSlotChainBuilder
to provide aHotParamSlotChainBuilder
Describe how to verify it
See test cases and demo.