Flow control by frequent (hot spot) parameters - #156
Merged
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>
sczyh30
force-pushed
the
feature/hot-param-flow-control
branch
from
September 25, 2018 09:23
c0e60d7 to
7b4acd5
Compare
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
sczyh30
force-pushed
the
feature/hot-param-flow-control
branch
from
September 25, 2018 09:27
7b4acd5 to
b24f5ff
Compare
Closed
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Arlmls
pushed a commit
to Arlmls/Sentinel
that referenced
this pull request
Jan 8, 2019
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
userIdas parameter, limit top-frequent usersproductIdas 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-controlundersentinel-extensionCacheMapinterface to provide abstraction for cache. We use ConcurrentLinkedHashMap as the default implementation (LRU strategy).ParameterMetricclass as frequent parameter metrics for a specific resource. The metric map is located inParamFlowSlotrather thanClusterNodeParameterLeapArrayas statistic data structure for frequent parameters in a period of time windowParamFlowSlotas the checker slot; AddParamFlowCheckerto do rule checking; AddParamFlowRuleManagerto do rule managingSlotChainBuilderto provide aHotParamSlotChainBuilderDescribe how to verify it
See test cases and demo.