-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Dynamic Rule Configuration
All the rules can be queried or modified in memory and these modifications take effects immediately. And Sentinel also provides APIs for developers to defines its own rules.
There are 3 kinds of rules: Flow rules, degrade rules, system rules.
1.Flow Rules
Flow Rule has following fields:
field | description | default value |
---|---|---|
resource | resource name | |
count | thredshold | |
grade | depends on QPS or concurrency(active thread count) | QPS |
limitApp | whether to count on callers | no |
strategy | count on the resource itself; or on the relate resource(refResource),or on entry resource(refResource) | resource itself |
controlBehavior | how to action after block criteria is met, to block immediately, or wait in queue, or slow warm up | block immediatley |
One resource can apply several rules
2.降级规则 降级规则包含下面几个重要的属性:
field | 说明 | 默认值 |
---|---|---|
resource | 资源名,资源名是限流规则的作用对象 | |
count | 限流阈值 | |
grade | 根据RT降级还是根据异常比例降级 | RT |
timeWindow | 降级的时间 |
同一个资源可以同时有多个降级规则。
3.系统保护规则
运行下面命令,则会返回现有生效的规则:
curl http://localhost:8719/getRules?type=? 其中,type=flow则以JSON格式返回现有的限流塑形规则;degrade则返回现有生效的降级规则列表;system则发挥系统保护规则
我们同时也可以通过下面命令,来修改已有规则:
curl http://localhost:8719/setRules?type=&data=,其中,type可以输入flow,degrade 等方式来制定更改的规则种类,data则是对应的JSON格式的规则。
上面的规则配置,都是出于内存状态的。即如果应用发生了重启,这个规则就会失效。我们提供了开放的接口。你可以通过实现 DataSource的方式,来自定义自己的持久化规则。通常我们的建议有:
- 整合Diamond,动态的实时刷新配置规则
- 结合SQL,GitHub等来实现该规则
- 和Dashboard一起。
重要的例子请参考 <TODOTODOTODO>
-
文档
-
Documents
- Read Me
- Introduction
- How to Use
- How it Works
- Flow Control
- Parameter Flow Control
- Cluster Flow Control
- API Gateway Flow Control
- Circuit Breaking
- Adaptive System Protection
- Metrics
- General Configuration
- Dynamic Rule Configuration
- Dashboard
- Integrations with open-source frameworks
- Contribution Guideline