mirror of https://github.com/istio/istio.io.git
zh: reference-adapter-redisquota (#2662)
This commit is contained in:
parent
e18b060317
commit
9e7294af9c
|
|
@ -1,18 +1,14 @@
|
|||
---
|
||||
title: 内存配额
|
||||
title: Memory quota
|
||||
description: 简单内存配额管理系统适配器。
|
||||
weight: 100
|
||||
location: https://istio.io/docs/reference/config/policy-and-telemetry/adapters/memquota.html
|
||||
layout: protoc-gen-docs
|
||||
generator: protoc-gen-docs
|
||||
number_of_entries: 3
|
||||
---
|
||||
|
||||
内存配额 (`memquota`) 适配器用于支持 Istio 配额管理系统。虽然功能齐全,但该适配器不适合生产使用,仅适用于本地测试。这种限制的原因是此适配器只能用于运行一个 Mixer 的环境中,不支持 HA 配置。如果该 Mixer 单点故障,则所有重要的配额值都将丢失。
|
||||
|
||||
这个适配器支持 [`quota template`](/docs/reference/config/policy-and-telemetry/templates/quota/)。
|
||||
这个适配器支持 [`quota template`](/zh/docs/reference/config/policy-and-telemetry/templates/quota/)。
|
||||
|
||||
## Params
|
||||
## 参数
|
||||
|
||||
内存配额适配器配置参数
|
||||
|
||||
|
|
@ -21,7 +17,7 @@ number_of_entries: 3
|
|||
|quotas|Params.Quota[]|quota 集合|
|
||||
|minDeduplicationDuration|[`google.protobuf.Duration`](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration)|去重操作持续时间的最小秒数。|
|
||||
|
||||
## Params.Override
|
||||
## Override
|
||||
|
||||
定义配额的覆盖值。如果没有覆盖匹配特定配额请求,则使用配额的默认值。
|
||||
|
||||
|
|
@ -31,7 +27,7 @@ number_of_entries: 3
|
|||
|maxAmount|int64|配额的上限数量|
|
||||
|validDuration|[`google.protobuf.Duration`](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration)|`google.protobuf.Duration` 有效的配额持续时间分配。此值只对速率配额有效,否则此值必须为零。|
|
||||
|
||||
## Params.Quota
|
||||
## Quota
|
||||
|
||||
定义配额限制和持续时间。
|
||||
|
||||
|
|
@ -40,4 +36,4 @@ number_of_entries: 3
|
|||
|name|string|配额名称|
|
||||
|maxAmount|int64|配额的上限数量|
|
||||
|validDuration|[`google.protobuf.Duration`](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration)|有效的配额持续时间分配。此值只对速率配额有效,否则此值必须为零。|
|
||||
|overrides|[`Params.Override[]`](/docs/reference/config/policy-and-telemetry/adapters/memquota/#Params-Override)|配额的覆盖值。首先定义的有效。|
|
||||
|overrides|[`Params.Override[]`](#Override)|配额的覆盖值。首先定义的有效。|
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
title: Redis Quota
|
||||
description: 基于 Redis 的配额管理系统。
|
||||
weight: 140
|
||||
---
|
||||
|
||||
`redisquota` 适配器可以用来给 Istio 的配额管理系统提供支持。它使用 Redis 服务器来存储配额数据。
|
||||
|
||||
这一适配器支持 [quota 模板](/zh/docs/reference/config/policy-and-telemetry/templates/quota/)。
|
||||
|
||||
## 参数
|
||||
|
||||
`redisquota` 适配器支持固定或滚动窗口算法的速率限制配额管理。它使用 Redis 存储共享数据。
|
||||
|
||||
配置样例:
|
||||
|
||||
{{< text yaml >}}
|
||||
redisServerUrl: localhost:6379
|
||||
connectionPoolSize: 10
|
||||
quotas:
|
||||
- name: requestcount.quota.istio-system
|
||||
maxAmount: 50
|
||||
validDuration: 60s
|
||||
bucketDuration: 1s
|
||||
rateLimitAlgorithm: ROLLING_WINDOW
|
||||
overrides:
|
||||
- dimensions:
|
||||
destination: ratings
|
||||
source: reviews
|
||||
maxAmount: 12
|
||||
- dimensions:
|
||||
destination: reviews
|
||||
maxAmount: 5
|
||||
{{< /text >}}
|
||||
|
||||
|字段|类型|描述|
|
||||
|---|---|---|
|
||||
|`quotas`|[`Params.Quota[]`](#quota)|已知的 `quota` 列表,其中至少包含一个 `quota` 配置|
|
||||
|`redisServerUrl`|`string`|Redis 连接字符串,例如 `localhost:6379`|
|
||||
|`connectionPoolSize`|`int64`|Redis 的最大闲置连接数。缺省设置为每 CPU 10 连接,CPU 数量来自 `runtime.NumCPU`|
|
||||
|
||||
## `Override`
|
||||
|
||||
|字段|类型|描述|
|
||||
|---|---|---|
|
||||
|`dimensions`|`map<string, string>`|为覆盖配置指定的 Dimension。字符串表达的 Dimension 来自模板配置,这个值不能为空|
|
||||
|`maxAmount`|`int64`|覆盖 `quota` 配置的上限值。这个值必须大于零|
|
||||
|
||||
## `Quota`
|
||||
|
||||
|字段|类型|描述|
|
||||
|---|---|---|
|
||||
|`name`|`string`|配额的名称|
|
||||
|`maxAmount`|`int64`|配额的上限,取值应大于零|
|
||||
|`validDuration`|[`google.protobuf.Duration`](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf)|在自动释放之前,已分配数额保持有效的时间长度。这只对速率限制配额有效,取值必须大于零|
|
||||
|`bucketDuration`|[`google.protobuf.Duration`](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf)|如果 `rateLimitAlgorithm` 设置为 `FIXED_WINDOW`,该字段无效,取值必须大于零且小于 `validDuration`|
|
||||
|`rateLimitAlgorithm`|[`Params.QuotaAlgorithm`](#quotaalgorithm)|配额管理算法,缺省值为 `FIXED_WINDOW`|
|
||||
|`overrides`|[`Params.Override[]`](#override)|这一配额的相关覆盖内容,第一次覆盖优先生效|
|
||||
|
||||
## `QuotaAlgorithm`
|
||||
|
||||
速率限制的算法。
|
||||
|
||||
|字段|描述|
|
||||
|---|---|
|
||||
|`FIXED_WINDOW`|固定窗口算法允许出现两倍的速率峰值,滑动窗口算法不会出现这样的情况|
|
||||
|`ROLLING_WINDOW`|滑动窗口算法提供更加精确的控制,但是也会提高对 Redis 资源的消耗|
|
||||
Loading…
Reference in New Issue