-
Notifications
You must be signed in to change notification settings - Fork 450
Open
Description
flowRules:
- id: "rule-1" # 可选,规则唯一ID
resource: "ddddddddd" # 资源名,必填
tokenCalculateStrategy: 0 # 令牌计算策略,0=Direct,1=WarmUp,2=MemoryAdaptive
controlBehavior: 1 # 控制行为,0=Reject,1=Throttling
threshold: 3 # 阈值(如QPS),必填
relationStrategy: 0 # 关联策略,0=CurrentResource,1=AssociatedResource
refResource: "" # 关联资源名,relationStrategy=1时必填
maxQueueingTimeMs: 20000 # 最大排队等待时间,仅Throttling时有效
warmUpPeriodSec: 0 # 预热时长(秒),仅WarmUp时有效
warmUpColdFactor: 3 # 预热冷因子,默认3
statIntervalInMs: 1000 # 统计窗口(毫秒),可选,默认1000
lowMemUsageThreshold: 0 # 低内存阈值,仅MemoryAdaptive时有效
highMemUsageThreshold: 0 # 高内存阈值,仅MemoryAdaptive时有效
memLowWaterMarkBytes: 0 # 低水位字节数,仅MemoryAdaptive时有效
memHighWaterMarkBytes: 0 # 高水位字节数,仅MemoryAdaptive时有效
controlBehavior: 1 这个配置了Throttling,不好使,10个并发还是3个给通过了,7个给限流了。
entry, err := api.Entry(
resource,
api.WithResourceType(base.ResTypeAPIGateway),
api.WithTrafficType(base.Inbound),
api.WithAttachments(attachments),
)
根据err判断是否限流的。
版本:github.com/alibaba/sentinel-golang v1.0.4
Metadata
Metadata
Assignees
Labels
No labels