Redis Quota
The redisquota
adapter can be used to support Istio’s quota managementsystem. It depends on a Redis server to store quota values.
This adapter supports the quota template.
Params
redisquota adapter supports the rate limit quota using either fixed orrolling window algorithm. And it is using Redis as a shared data storage.
Example configuration:
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
Field | Type | Description | Required |
---|---|---|---|
quotas | Quota[] | The set of known quotas. At least one quota configuration is required | No |
redisServerUrl | string | Redis connection string <hostname>:<port number> ex) localhost:6379 | No |
connectionPoolSize | int64 | Maximum number of idle connections to redisDefault is 10 connections per every CPU as reported by runtime.NumCPU. | No |
Params.Override
Field | Type | Description | Required |
---|---|---|---|
dimensions | map<string, string> | The specific dimensions for which this override applies.String representation of instance dimensions is used to check against configured dimensions. dimensions should not be empty | No |
maxAmount | int64 | The upper limit for this quota override.This value should be bigger than 0 | No |
Params.Quota
Field | Type | Description | Required |
---|---|---|---|
name | string | The name of the quota | No |
maxAmount | int64 | The upper limit for this quota. max_amount should be bigger than 0 | No |
validDuration | Duration | The amount of time allocated quota remains valid before it isautomatically released. This is only meaningful for rate limit quotas.value should be 0 < validDuration | No |
bucketDuration | Duration | The bucketDuration will be ignored if rateLimitAlgorithm is FIXED_WINDOW value should be 0 < bucketDuration < validDuration | No |
rateLimitAlgorithm | QuotaAlgorithm | Quota management algorithm. The default value is FIXED_WINDOW | No |
overrides | Override[] | Overrides associated with this quota.The first matching override is applied. | No |
Params.QuotaAlgorithm
Algorithms for rate-limiting:
Name | Description |
---|---|
FIXED_WINDOW | FIXED_WINDOW The fixed window approach can allow 2x peak specified rate, whereas the rolling-window doesn’t. |
ROLLING_WINDOW | ROLLING_WINDOW The rolling window algorithm’s additional precision comes at the cost of increased redis resource usage. |