resource rules (flow/degrade/param/authority) support regex matching#3251
Merged
LearningGp merged 1 commit intoalibaba:masterfrom Dec 27, 2023
Merged
resource rules (flow/degrade/param/authority) support regex matching#3251LearningGp merged 1 commit intoalibaba:masterfrom
LearningGp merged 1 commit intoalibaba:masterfrom
Conversation
LearningGp
requested changes
Dec 21, 2023
cf4e8c5 to
afd167a
Compare
Collaborator
|
It would be helpful to have a benchmark report comparing the original rules. 🚀 |
Contributor
Author
Throughput (s)Throughput (ns)AverageTime (ns)
Due to the need to retrieve rules from the regex cache map and regular rules, the throughput of the previous retrieval method is twice that of direct retrieval, which means there is an additional get method, but it is also within an acceptable range. |
Collaborator
|
Thanks for contributing! 🚀 |
LearningGp
pushed a commit
that referenced
this pull request
Dec 28, 2023
z-soulx
pushed a commit
to z-soulx/Sentinel
that referenced
this pull request
May 27, 2024
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
Resource rules support matching resource names according to regular rules, allowing users to configure traffic limiting rules or batch configuration.
When adding/deleting interfaces, there is no need to manually create/delete rules.
资源规则支持按照正则匹配资源名称,允许用户按照配置兜底限流规则或批量配置的能力。
当新增/删除接口时,无需手动创建/删除规则。
Does this pull request fix one issue?
Fixes #3247
Describe how you did it
Add a RuleManger to uniformly manage ordinary rules and regular rules. In order to reduce the performance loss caused by regular parsing/matching, the following two methods are used:
增加一个 RuleManger 统一管理普通规则和正则规则,为了减少正则解析/匹配所带来的性能损耗,使用下面两种方式:
Describe how to verify it
Regular unit tests have been added to each of the four rules to ensure normal performance; if regular rules are turned on, current limiting rules that meet regular matching but have different resource names will take effect.
对四种规则分别增加了正则的单元测试,用于保证表现正常;如果开启了正则规则,满足正则匹配但资源名称不同的限流规则均会生效。
Special notes for reviews
None