Replies: 2 comments 4 replies
-
|
CC @hanxiantao cc @韩香桃 |
Beta Was this translation helpful? Give feedback.
-
目前一个 rule 下可以支持多种匹配维度的,我理解你要的效果是 consumer 到达阈值或者 header 中的某个业务 key 到达阈值时,拒绝请求 rule_name: default_rule
rule_items:
- limit_by_header: x-ca-key # 根据请求头限流
limit_keys:
- key: 102234
token_per_minute: 10
- key: 308239
token_per_hour: 10
- limit_by_consumer: '' # 根据consumer限流
limit_keys:
- key: consumer1
token_per_second: 10
- key: consumer2
token_per_hour: 100
redis:
service_name: redis.static看下是否能满足你的需求,详细可以看下 AI Token 限流插件配置文档:https://higress.io/docs/latest/user/plugins/ai/api-consumer/ai-token-ratelimit/
Currently, one rule can support multiple matching dimensions. I understand that the effect you want is to reject the request when the consumer reaches the threshold or a business key in the header reaches the threshold. rule_name: default_rule
rule_items:
- limit_by_header: x-ca-key # Limit current flow based on request header
limit_keys:
- key: 102234
token_per_minute: 10
- key: 308239
token_per_hour: 10
- limit_by_consumer: '' # Limit current based on consumer
limit_keys:
- key: consumer1
token_per_second: 10
- key: consumer2
token_per_hour: 100
redis:
service_name: redis.staticSee if it can meet your needs. For details, you can read the AI Token rate limit plug-in configuration document: https://higress.io/docs/latest/user/plugins/ai/api-consumer/ai-token-ratelimit/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
现在的单个ai-token-ratelimit实例只能配置一个rule, 如果我想同时控制consumer和header中的某个业务key流量, 例如当consumer维度到达阈值或者header中的某个业务key到达阈值时, 拒绝请求, 反之两个维度的token计算都incr, 应该如何配置? 串联两个ai-token-ratelimit实例吗?
Currently, a single ai-token-ratelimit instance can only be configured with one rule. If I want to control the traffic of a certain business key in the consumer and header at the same time, for example, when the consumer dimension reaches the threshold or a certain business key in the header reaches the threshold, the request is rejected. Otherwise, the token calculation in both dimensions is incr. How should I configure it? Can I connect two ai-token-ratelimit instances in series?
Beta Was this translation helpful? Give feedback.
All reactions