hf400159 commented on code in PR #7030: URL: https://github.com/apache/apisix/pull/7030#discussion_r871030917
##########
docs/en/latest/plugins/limit-conn.md:
##########
@@ -23,25 +29,25 @@ title: limit-conn
## Description
-Limiting request concurrency plugin.
+The `limit-con` Plugin limits the number of concurrent requests to your
services.
## Attributes
-| Name | Type | Requirement | Default | Valid
|
Description
|
-| ------------------ | ------- | ----------- | ------- |
-----------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-| conn | integer | required | | conn > 0
| the
maximum number of concurrent requests allowed. Requests exceeding this ratio
(and below `conn` + `burst`) will get delayed(the latency seconds is configured
by `default_conn_delay`) to conform to this threshold.
|
-| burst | integer | required | | burst >= 0
| the
number of excessive concurrent requests (or connections) allowed to be delayed.
|
-| default_conn_delay | number | required | | default_conn_delay >
0 | the
latency seconds of request when concurrent requests exceeding `conn` but below
(`conn` + `burst`).
|
-| only_use_default_delay | boolean | optional | false | [true,false]
|
enable the strict mode of the latency seconds. If you set this option to
`true`, it will run strictly according to the latency seconds you set without
additional calculation logic.
|
-| key_type | string | optional | "var" | ["var",
"var_combination"] | the type of key. |
-| key | string | required | | | the user specified key
to limit the rate. If the `key_type` is "var", the key will be treated as a
name of variable, like "remote_addr" or "consumer_name". If the `key_type` is
"var_combination", the key will be a combination of variables, like
"$remote_addr $consumer_name". If the value of the key is empty, `remote_addr`
will be set as the default key.|
-| rejected_code | string | optional | 503 | [200,...,599]
| the HTTP
status code returned when the request exceeds `conn` + `burst` will be
rejected.
|
-| rejected_msg | string | optional |
| non-empty | the response body returned
when the request exceeds `conn` + `burst` will be rejected.
|
-| allow_degradation | boolean | optional
| false |
| Whether to enable plugin degradation when the limit-conn function
is temporarily unavailable. Allow requests to continue when the value is set to
true, default false. |
+| Name | Type | Required | Default | Valid values
| Description
|
+|------------------------|---------|----------|---------|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| conn | integer | True | | conn > 0
| Maximum number of concurrent requests allowed. Requests exceeding this
ratio (and below `conn` + `burst`) will be delayed (configured by
`default_conn_delay`).
|
+| burst | integer | True | | burst >= 0
| Number of additional concurrent requests allowed to be delayed per
second. If the number exceeds this hard limit, they will get rejected
immediately.
|
+| default_conn_delay | number | True | | default_conn_delay >
0 | Delay in seconds to process the concurrent requests exceeding `conn`
(and `conn` + `burst`).
|
+| only_use_default_delay | boolean | False | false | [true,false]
| When set to `true`, the Plugin will always set a delay of
`default_conn_delay` and would not use any other calculations.
|
+| key_type | string | False | "var" | ["var",
"var_combination"] | Type of user specified key to use.
|
+| key | string | True | |
| User specified key to base the request limiting on. If the `key_type`
attribute is set to `var`, the key will be treated as a name of variable, like
`remote_addr` or `consumer_name`. If the `key_type` is set to
`var_combination`, the key will be a combination of variables, like
`$remote_addr $consumer_name`. If the value of the key is empty, `remote_addr`
will be set as the default key. |
+| rejected_code | string | False | 503 | [200,...,599]
| HTTP status code returned when the requests exceeding the threshold are
rejected.
|
+| rejected_msg | string | False | | non-empty
| Body of the response returned when the requests exceeding the threshold
are rejected.
|
+| allow_degradation | boolean | False | false |
| When set to true enables Plugin degradation when the Plugin is
temporarily unavailable and allows requests to continue.
|
Review Comment:
```suggestion
| allow_degradation | boolean | False | false |
| When set to `true` enables Plugin degradation when the Plugin is
temporarily unavailable and allows requests to continue.
|
```
##########
docs/en/latest/plugins/limit-count.md:
##########
@@ -23,33 +29,33 @@ title: limit-count
## Description
-Limit request rate by a fixed number of requests in a given time window.
+The `limit-count` Plugin limits the number of requests to your service by a
given count per time.
## Attributes
-| Name | Type | Requirement |
Default | Valid
| Description
|
-| ------------------- | ------- | --------------------------------------- |
------------- |
-------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-| count | integer | required |
| count > 0
| the specified number of requests
threshold.
|
-| time_window | integer | required |
| time_window > 0
| the time window in seconds before the request count
is reset.
|
-| key_type | string | optional | "var" | ["var",
"var_combination", "constant"] | the type of key. |
-| key | string | optional | "remote_addr" | | the user
specified key to limit the rate. If the `key_type` is "constant", the key will
be treated as a constant. If the `key_type` is "var", the key will be treated
as a name of variable. If the `key_type` is "var_combination", the key will be
a combination of variables. For example, if we use "$remote_addr
$consumer_name" as key, plugin will be restricted by two variables which are
"remote_addr" and "consumer_name". If the value of the key is empty,
`remote_addr` will be set as the default key.|
-| rejected_code | integer | optional |
503 | [200,...,599]
| The HTTP status code returned when
the request exceeds the threshold is rejected, default 503.
|
-| rejected_msg | string | optional |
| non-empty
| The response body returned when the request
exceeds the threshold is rejected.
|
-| policy | string | optional |
"local" | ["local", "redis", "redis-cluster"]
| The rate-limiting policies to use for
retrieving and incrementing the limits. Available values are `local`(the
counters will be stored locally in-memory on the node), `redis`(counters are
stored on a Redis server and will be shared across the nodes, usually use it to
do the global speed limit), and `redis-cluster` which works the same as `redis`
but with redis cluster. |
-| allow_degradation | boolean | optional
| false |
| Whether to enable plugin degradation when the limit-count function
is temporarily unavailable(e.g. redis timeout). Allow requests to continue when
the value is set to true, default false. |
-| show_limit_quota_header | boolean | optional
| true |
| Whether show `X-RateLimit-Limit` and `X-RateLimit-Remaining`
(which mean the total number of requests and the remaining number of requests
that can be sent) in the response header, default true. |
-| group | string | optional |
| non-empty
| Route configured with the same group will share
the same counter |
-| redis_host | string | required for `redis` |
|
| When using the `redis` policy, this
property specifies the address of the Redis server.
|
-| redis_port | integer | optional |
6379 | [1,...]
| When using the `redis` policy, this
property specifies the port of the Redis server.
|
-| redis_password | string | optional |
|
| When using the `redis` or
`redis-cluster` policy, this property specifies the password of the Redis
server.
|
-| redis_database | integer | optional | 0
| redis_database >= 0
| When using the `redis` policy, this
property specifies the database you selected of the Redis server, and only for
non Redis cluster mode (single instance mode or Redis public cloud service that
provides single entry).
|
-| redis_timeout | integer | optional |
1000 | [1,...]
| When using the `redis` or
`redis-cluster` policy, this property specifies the timeout in milliseconds of
any command submitted to the Redis server.
|
-| redis_cluster_nodes | array | required when policy is `redis-cluster` |
|
| When using `redis-cluster` policy,This
property is a list of addresses of Redis cluster service nodes (at least two).
|
-| redis_cluster_name | string | required when policy is `redis-cluster` |
|
| When using `redis-cluster` policy, this
property is the name of Redis cluster service nodes.
|
-
-## How To Enable
-
-Here's an example, enable the `limit count` plugin on the specified route when
setting `key_type` to `var` :
+| Name | Type | Required
| Default | Valid values | Description
|
+|-------------------------|---------|-------------------------------------------|---------------|----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| count | integer | True
| | count > 0 | Maximum number of
requests to allow.
|
+| time_window | integer | True
| | time_window > 0 | Time in seconds
before `count` is reset.
|
+| key_type | string | False
| "var" | ["var", "var_combination", "constant"] | Type of user
specified key to use.
|
+| key | string | False
| "remote_addr" | | User specified key
to base the request limiting on. If the `key_type` attribute is set to
`constant`, the key will be treated as a constant value. If the `key_type`
attribute is set to `var`, the key will be treated as a name of variable, like
`remote_addr` or `consumer_name`. If the `key_type` is set to
`var_combination`, the key will be a combination of variables, like
`$remote_addr $consumer_name`. If the value of the key is empty, `remote_addr`
will be set as the default key. |
+| rejected_code | integer | False
| 503 | [200,...,599] | HTTP status code
returned when the requests exceeding the threshold are rejected.
|
+| rejected_msg | string | False
| | non-empty | Body of the
response returned when the requests exceeding the threshold are rejected.
|
+| policy | string | False
| "local" | ["local", "redis", "redis-cluster"] | Rate-limiting
policies to use for retrieving and increment the limit count. When set to
`local` the counters will be locally stored in memory on the node. When set to
`redis` counters are stored on a Redis server and will be shared across the
nodes. It is done usually for global speed limiting, and setting to
`redis-cluster` uses a Redis cluster instead of a single instance.
|
Review Comment:
we can add a separate form to introduce Enum. I have seen other products do
this.
##########
docs/en/latest/plugins/limit-count.md:
##########
@@ -23,33 +29,33 @@ title: limit-count
## Description
-Limit request rate by a fixed number of requests in a given time window.
+The `limit-count` Plugin limits the number of requests to your service by a
given count per time.
## Attributes
-| Name | Type | Requirement |
Default | Valid
| Description
|
-| ------------------- | ------- | --------------------------------------- |
------------- |
-------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-| count | integer | required |
| count > 0
| the specified number of requests
threshold.
|
-| time_window | integer | required |
| time_window > 0
| the time window in seconds before the request count
is reset.
|
-| key_type | string | optional | "var" | ["var",
"var_combination", "constant"] | the type of key. |
-| key | string | optional | "remote_addr" | | the user
specified key to limit the rate. If the `key_type` is "constant", the key will
be treated as a constant. If the `key_type` is "var", the key will be treated
as a name of variable. If the `key_type` is "var_combination", the key will be
a combination of variables. For example, if we use "$remote_addr
$consumer_name" as key, plugin will be restricted by two variables which are
"remote_addr" and "consumer_name". If the value of the key is empty,
`remote_addr` will be set as the default key.|
-| rejected_code | integer | optional |
503 | [200,...,599]
| The HTTP status code returned when
the request exceeds the threshold is rejected, default 503.
|
-| rejected_msg | string | optional |
| non-empty
| The response body returned when the request
exceeds the threshold is rejected.
|
-| policy | string | optional |
"local" | ["local", "redis", "redis-cluster"]
| The rate-limiting policies to use for
retrieving and incrementing the limits. Available values are `local`(the
counters will be stored locally in-memory on the node), `redis`(counters are
stored on a Redis server and will be shared across the nodes, usually use it to
do the global speed limit), and `redis-cluster` which works the same as `redis`
but with redis cluster. |
-| allow_degradation | boolean | optional
| false |
| Whether to enable plugin degradation when the limit-count function
is temporarily unavailable(e.g. redis timeout). Allow requests to continue when
the value is set to true, default false. |
-| show_limit_quota_header | boolean | optional
| true |
| Whether show `X-RateLimit-Limit` and `X-RateLimit-Remaining`
(which mean the total number of requests and the remaining number of requests
that can be sent) in the response header, default true. |
-| group | string | optional |
| non-empty
| Route configured with the same group will share
the same counter |
-| redis_host | string | required for `redis` |
|
| When using the `redis` policy, this
property specifies the address of the Redis server.
|
-| redis_port | integer | optional |
6379 | [1,...]
| When using the `redis` policy, this
property specifies the port of the Redis server.
|
-| redis_password | string | optional |
|
| When using the `redis` or
`redis-cluster` policy, this property specifies the password of the Redis
server.
|
-| redis_database | integer | optional | 0
| redis_database >= 0
| When using the `redis` policy, this
property specifies the database you selected of the Redis server, and only for
non Redis cluster mode (single instance mode or Redis public cloud service that
provides single entry).
|
-| redis_timeout | integer | optional |
1000 | [1,...]
| When using the `redis` or
`redis-cluster` policy, this property specifies the timeout in milliseconds of
any command submitted to the Redis server.
|
-| redis_cluster_nodes | array | required when policy is `redis-cluster` |
|
| When using `redis-cluster` policy,This
property is a list of addresses of Redis cluster service nodes (at least two).
|
-| redis_cluster_name | string | required when policy is `redis-cluster` |
|
| When using `redis-cluster` policy, this
property is the name of Redis cluster service nodes.
|
-
-## How To Enable
-
-Here's an example, enable the `limit count` plugin on the specified route when
setting `key_type` to `var` :
+| Name | Type | Required
| Default | Valid values | Description
|
+|-------------------------|---------|-------------------------------------------|---------------|----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| count | integer | True
| | count > 0 | Maximum number of
requests to allow.
|
+| time_window | integer | True
| | time_window > 0 | Time in seconds
before `count` is reset.
|
+| key_type | string | False
| "var" | ["var", "var_combination", "constant"] | Type of user
specified key to use.
|
+| key | string | False
| "remote_addr" | | User specified key
to base the request limiting on. If the `key_type` attribute is set to
`constant`, the key will be treated as a constant value. If the `key_type`
attribute is set to `var`, the key will be treated as a name of variable, like
`remote_addr` or `consumer_name`. If the `key_type` is set to
`var_combination`, the key will be a combination of variables, like
`$remote_addr $consumer_name`. If the value of the key is empty, `remote_addr`
will be set as the default key. |
+| rejected_code | integer | False
| 503 | [200,...,599] | HTTP status code
returned when the requests exceeding the threshold are rejected.
|
+| rejected_msg | string | False
| | non-empty | Body of the
response returned when the requests exceeding the threshold are rejected.
|
+| policy | string | False
| "local" | ["local", "redis", "redis-cluster"] | Rate-limiting
policies to use for retrieving and increment the limit count. When set to
`local` the counters will be locally stored in memory on the node. When set to
`redis` counters are stored on a Redis server and will be shared across the
nodes. It is done usually for global speed limiting, and setting to
`redis-cluster` uses a Redis cluster instead of a single instance.
|
+| allow_degradation | boolean | False
| false | | When set to true
enables Plugin degradation when the Plugin is temporarily unavailable (for
example, a Redis timeout) and allows requests to continue.
|
Review Comment:
```suggestion
| allow_degradation | boolean | False
| false | | When set to
`true` enables Plugin degradation when the Plugin is temporarily unavailable
(for example, a Redis timeout) and allows requests to continue.
|
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
