Re: [PR] docs(limit-conn): re-port with Admin API, ADC, and Ingress Controller tabs [apisix]
Yilialinn merged PR #13215: URL: https://github.com/apache/apisix/pull/13215 -- 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]
Re: [PR] docs(limit-conn): re-port with Admin API, ADC, and Ingress Controller tabs [apisix]
Yilialinn commented on code in PR #13215: URL: https://github.com/apache/apisix/pull/13215#discussion_r3099094844 ## docs/en/latest/plugins/limit-conn.md: ## @@ -41,8 +41,8 @@ The `limit-conn` Plugin limits the rate of requests by the number of concurrent | Name | Type | Required | Default | Valid values | Description | |--|--|--|-|--|-| -| conn | integer,string | False | | integer > 0, or a variable expression | The maximum number of concurrent requests allowed. Requests exceeding the configured limit and below `conn + burst` will be delayed. Required if `rules` is not configured. | -| burst | integer,string | False | | integer >= 0, or a variable expression | The number of excessive concurrent requests allowed to be delayed. Requests exceeding `conn + burst` will be rejected immediately. Required if `rules` is not configured. | +| conn | integer,string | False | | integer > 0, or lua-resty-expr[https://github.com/api7/lua-resty-expr] | The maximum number of concurrent requests allowed. Requests exceeding the configured limit and below `conn + burst` will be delayed. Required if `rules` is not configured. | +| burst | integer,string | False | | integer >= 0, or lua-resty-expr[https://github.com/api7/lua-resty-expr] | The number of excessive concurrent requests allowed to be delayed. Requests exceeding `conn + burst` will be rejected immediately. Required if `rules` is not configured. | Review Comment: https://github.com/user-attachments/assets/5a004d30-a175-4867-a5d6-96e38bb6945c"; /> -- 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]
Re: [PR] docs(limit-conn): re-port with Admin API, ADC, and Ingress Controller tabs [apisix]
kayx23 commented on code in PR #13215: URL: https://github.com/apache/apisix/pull/13215#discussion_r3098911706 ## docs/en/latest/plugins/limit-conn.md: ## @@ -41,8 +41,8 @@ The `limit-conn` Plugin limits the rate of requests by the number of concurrent | Name | Type | Required | Default | Valid values | Description | |--|--|--|-|--|-| -| conn | integer,string | False | | integer > 0, or a variable expression | The maximum number of concurrent requests allowed. Requests exceeding the configured limit and below `conn + burst` will be delayed. Required if `rules` is not configured. | -| burst | integer,string | False | | integer >= 0, or a variable expression | The number of excessive concurrent requests allowed to be delayed. Requests exceeding `conn + burst` will be rejected immediately. Required if `rules` is not configured. | +| conn | integer,string | False | | integer > 0, or lua-resty-expr[https://github.com/api7/lua-resty-expr] | The maximum number of concurrent requests allowed. Requests exceeding the configured limit and below `conn + burst` will be delayed. Required if `rules` is not configured. | +| burst | integer,string | False | | integer >= 0, or lua-resty-expr[https://github.com/api7/lua-resty-expr] | The number of excessive concurrent requests allowed to be delayed. Requests exceeding `conn + burst` will be rejected immediately. Required if `rules` is not configured. | Review Comment: Where did you commit though... it says "This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository." -- 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]
Re: [PR] docs(limit-conn): re-port with Admin API, ADC, and Ingress Controller tabs [apisix]
Yilialinn commented on code in PR #13215: URL: https://github.com/apache/apisix/pull/13215#discussion_r3098883077 ## docs/en/latest/plugins/limit-conn.md: ## @@ -41,8 +41,8 @@ The `limit-conn` Plugin limits the rate of requests by the number of concurrent | Name | Type | Required | Default | Valid values | Description | |--|--|--|-|--|-| -| conn | integer,string | False | | integer > 0, or a variable expression | The maximum number of concurrent requests allowed. Requests exceeding the configured limit and below `conn + burst` will be delayed. Required if `rules` is not configured. | -| burst | integer,string | False | | integer >= 0, or a variable expression | The number of excessive concurrent requests allowed to be delayed. Requests exceeding `conn + burst` will be rejected immediately. Required if `rules` is not configured. | +| conn | integer,string | False | | integer > 0, or lua-resty-expr[https://github.com/api7/lua-resty-expr] | The maximum number of concurrent requests allowed. Requests exceeding the configured limit and below `conn + burst` will be delayed. Required if `rules` is not configured. | +| burst | integer,string | False | | integer >= 0, or lua-resty-expr[https://github.com/api7/lua-resty-expr] | The number of excessive concurrent requests allowed to be delayed. Requests exceeding `conn + burst` will be rejected immediately. Required if `rules` is not configured. | Review Comment: fixed in https://github.com/apache/apisix/pull/13215/changes/930e0ac02ba7910673f83a98837a822712f8897c -- 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]
Re: [PR] docs(limit-conn): re-port with Admin API, ADC, and Ingress Controller tabs [apisix]
kayx23 commented on code in PR #13215: URL: https://github.com/apache/apisix/pull/13215#discussion_r3098794819 ## docs/en/latest/plugins/limit-conn.md: ## @@ -41,8 +41,8 @@ The `limit-conn` Plugin limits the rate of requests by the number of concurrent | Name | Type | Required | Default | Valid values | Description | |--|--|--|-|--|-| -| conn | integer,string | False | | integer > 0, or a variable expression | The maximum number of concurrent requests allowed. Requests exceeding the configured limit and below `conn + burst` will be delayed. Required if `rules` is not configured. | -| burst | integer,string | False | | integer >= 0, or a variable expression | The number of excessive concurrent requests allowed to be delayed. Requests exceeding `conn + burst` will be rejected immediately. Required if `rules` is not configured. | +| conn | integer,string | False | | integer > 0, or lua-resty-expr[https://github.com/api7/lua-resty-expr] | The maximum number of concurrent requests allowed. Requests exceeding the configured limit and below `conn + burst` will be delayed. Required if `rules` is not configured. | +| burst | integer,string | False | | integer >= 0, or lua-resty-expr[https://github.com/api7/lua-resty-expr] | The number of excessive concurrent requests allowed to be delayed. Requests exceeding `conn + burst` will be rejected immediately. Required if `rules` is not configured. | Review Comment: wrong markdown syntax to add hyperlink -- 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]
Re: [PR] docs(limit-conn): re-port with Admin API, ADC, and Ingress Controller tabs [apisix]
kayx23 commented on code in PR #13215: URL: https://github.com/apache/apisix/pull/13215#discussion_r3094964656 ## docs/en/latest/plugins/limit-conn.md: ## @@ -30,43 +30,46 @@ description: The limit-conn plugin restricts the rate of requests by managing co https://docs.api7.ai/hub/limit-conn"; /> +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + ## Description The `limit-conn` Plugin limits the rate of requests by the number of concurrent connections. Requests exceeding the threshold will be delayed or rejected based on the configuration, ensuring controlled resource usage and preventing overload. ## Attributes -| Name | Type| Required | Default | Valid values | Description | -||-|--|-|---|-| -| conn | integer | False | | > 0 | The maximum number of concurrent requests allowed. Requests exceeding the configured limit and below `conn + burst` will be delayed. Required if `rules` is not configured. | -| burst | integer | False | | >= 0| The number of excessive concurrent requests allowed to be delayed per second. Requests exceeding the limit will be rejected immediately. Required if `rules` is not configured. | -| default_conn_delay | number | True | | > 0| Processing latency allowed in seconds for concurrent requests exceeding `conn + burst`, which can be dynamically adjusted based on `only_use_default_delay` setting. | -| only_use_default_delay | boolean | False| false | | If false, delay requests proportionally based on how much they exceed the `conn` limit. The delay grows larger as congestion increases. For instance, with `conn` being `5`, `burst` being `3`, and `default_conn_delay` being `1`, 6 concurrent requests would result in a 1-second delay, 7 requests a 2-second delay, 8 requests a 3-second delay, and so on, until the total limit of `conn + burst` is reached, beyond which requests are rejected. If true, use `default_conn_delay` to delay all excessive requests within the `burst` range. Requests beyond `conn + burst` are rejected immediately. For instance, with `conn` being `5`, `burst` being `3`, and `default_conn_delay` being `1`, 6, 7, or 8 concurrent requests are all delayed by exactly 1 second each. | -| rules| array[object] | False| | | A list of connection limiting rules. Each rule is an object containing `conn`, `burst`, and `key`. If configured, this takes precedence over `conn`, `burst`, and `key`. | -| rules.conn | integer or string | True | | > 0 or variable expression | The maximum number of concurrent requests allowed. Can be a static integer or a variable expression like `$http_custom_conn`. | -| rules.burst | integer or string | True | | >= 0 or variable expression | The number of excessive concurrent requests allowed to be delayed. Can be a static integer or a variable expression. | -| rules.key| string | True | | | The key to count requests by. If the configured key does not exist, the rule will not be executed. The `key` is interpreted as a combination of variables, for example: `$http_custom_a $http_custom_b`. | -| key_type| string | False | var | ["var","var_combination"] | The type of key. If the `key_type` is `var`, the `key` is interpreted a variable. If the `key_type` is `var_combination`, the `key` is interpreted as a combination of variables.| -| key | string | False | remote_addr | | The key to count requests by. If the `key_type` is `var`, the `key` is interpreted a variable. The variable does not need to be prefixed by a dollar sign (`$`). If the `key_type` is `var_combination`, the `key` is interpreted as a combination of variables. All variables should be prefixed by dollar signs (`$`). For example, to configure the `key` to use a combination of two request headers `custom-a` and `custom-b`, the `key` should be configured as `$http_custom_a $http_custom_b`. Required if `rules` is not configured. | -| key_ttl | integer | False | 3600 | | The TTL of the Redis key in seconds. Used when `policy` is `redis` or `redis-cluster`. | -| rejected_code | integer | False | 503 | [200,...,599] | The HTTP status code returned when a request is rejected for exceeding the threshold. | -| rejected_msg| string | False| | non-empty | The response body returned when a request is rejected for exceeding the threshold. | -| allow_degradation | boolean | False | false | | If true, allow APISIX to continue handling requests without the Plugin when the Plugin or its dependencies become unavailable.| -| policy| string | False | local | ["loca
Re: [PR] docs(limit-conn): re-port with Admin API, ADC, and Ingress Controller tabs [apisix]
Copilot commented on code in PR #13215: URL: https://github.com/apache/apisix/pull/13215#discussion_r3090312466 ## docs/zh/latest/plugins/limit-conn.md: ## @@ -264,40 +658,183 @@ docker run -d \ jmalloc/echo-server ``` -创建到服务器 WebSocket 端点的路由,并为路由启用 WebSocket。相应地调整 WebSocket 服务器地址。 +该服务器在 `/.ws` 路径上有一个 WebSocket 端点,会回显收到的任何消息。 + Review Comment: WebSocket 示例先通过 `docker run` 启动上游,但 “Ingress Controller” 标签页的 YAML 直接引用了 Kubernetes 中名为 `websocket-server` 的 Service(片段里也没有定义该 Service)。这会导致按文档操作时 Ingress 配置无法直接运行。建议在 Ingress 标签页补充 WebSocket 服务的 Deployment/Service(或 ExternalName Service),或明确说明需要预先创建 `websocket-server` Service。 ```suggestion :::note 上述 `docker run` 示例适用于直接将路由指向 Docker 网络中的上游容器。 如果使用下方的 **Ingress Controller** 标签页,请先在 Kubernetes 集群中创建名为 `websocket-server` 的 Service,并确保它可以将流量转发到实际的 WebSocket 服务后端(例如通过 Deployment/Service,或其他等价方式暴露该服务)。否则,Ingress 中对 `websocket-server` 的引用将无法生效。 ::: ``` ## docs/en/latest/plugins/limit-conn.md: ## @@ -264,34 +658,177 @@ docker run -d \ jmalloc/echo-server ``` -Create a Route to the server WebSocket endpoint and enable WebSocket for the route. Adjust the WebSocket server address accordingly. +The server has a WebSocket endpoint at `/.ws` that echoes back any message received. + Review Comment: In the WebSocket example, the section first starts an upstream via `docker run`, but the Ingress Controller tab YAML references a Kubernetes Service named `websocket-server` (and the snippet doesn’t define that Service). This makes the Ingress path non-runnable as written. Consider either adding a K8s Deployment/Service manifest for the WebSocket server (or an ExternalName Service) in the Ingress tab, or clarifying that `websocket-server` must already exist in the cluster. ```suggestion In the following examples, the Admin API configuration uses the Docker container hostname `websocket-server` on the `apisix-quickstart-net` network. If you use the Ingress Controller example, make sure a Kubernetes Service named `websocket-server` already exists in your cluster, or update the backend reference to match an existing Service. ``` ## docs/zh/latest/plugins/limit-conn.md: ## @@ -30,43 +30,46 @@ description: limit-conn 插件通过管理并发连接来限制请求速率。 https://docs.api7.ai/hub/limit-conn"; /> +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + ## 描述 `limit-conn` 插件通过并发连接数来限制请求速率。超过阈值的请求将根据配置被延迟或拒绝,从而确保可控的资源使用并防止过载。 ## 属性 -| 名称| 类型| 必选项| 默认值 | 有效值 | 描述 | -||-|--|---||--| -| conn | integer | 否 | | > 0 | 允许的最大并发请求数。超过配置的限制且低于`conn + burst`的请求将被延迟。如果未配置 `rules`,则为必填项。| -| burst | integer | 否 | | >= 0 | 每秒允许延迟的过多并发请求数。超过限制的请求将被立即拒绝。如果未配置 `rules`,则为必填项。| -| default_conn_delay | number | 是 | | > 0 | 允许超过`conn + burst`的并发请求的处理延迟(秒),可根据`only_use_default_delay`设置动态调整。| -| only_use_default_delay | boolean | 否 | false | | 如果为 false,则根据请求超出`conn`限制的程度按比例延迟请求。拥塞越严重,延迟就越大。例如,当 `conn` 为 `5`、`burst` 为 `3` 且 `default_conn_delay` 为 `1` 时,6 个并发请求将导致 1 秒的延迟,7 个请求将导致 2 秒的延迟,8 个请求将导致 3 秒的延迟,依此类推,直到达到 `conn + burst` 的总限制,超过此限制的请求将被拒绝。如果为 true,则使用 `default_conn_delay` 延迟 `burst` 范围内的所有超额请求。超出 `conn + burst` 的请求将被立即拒绝。例如,当 `conn` 为 `5`、`burst` 为 `3` 且 `default_conn_delay` 为 `1` 时,6、7 或 8 个并发请求都将延迟 1 秒。| -| rules| array[object] | 否| | | 连接限制规则列表。每个规则是一个包含 `conn`、`burst` 和 `key` 的对象。如果配置了此项,则优先于 `conn`、`burst` 和 `key`。 | -| rules.conn | integer 或 string | 是 | | > 0 或变量表达式 | 允许的最大并发请求数。可以是静态整数或变量表达式,如 `$http_custom_conn`。 | -| rules.burst | integer 或 string | 是 | | >= 0 或变量表达式 | 允许延迟的过多并发请求数。可以是静态整数或变量表达式。 | -| rules.key| string | 是 | | | 用于计数请求的键。如果配置的键不存在,则不会执行该规则。`key` 被解释为变量组合,例如:`$http_custom_a $http_custom_b`。 | -| key_type | string | 否 | var | ["var","var_combination"] | key 的类型。如果`key_type` 为 `var`,则 `key` 将被解释为变量。如果 `key_type` 为 `var_combination`,则 `key` 将被解释为变量的组合。 | -| key | string | 否 | remote_addr | | 用于计数请求的 key。如果 `key_type` 为 `var`,则 `key` 将被解释为变量。变量不需要以美元符号(`$`)为前缀。如果 `key_type` 为 `var_combination`,则 `key` 会被解释为变量的组合。所有变量都应该以美元符号 (`$`) 为前缀。例如,要配置 `key` 使用两个请求头 `custom-a` 和 `custom-b` 的组合,则 `key` 应该配置为 `$http_custom_a $http_custom_b`。如果未配置 `rules`,则为必填项。| -| key_ttl | integer | 否 | 3600 | | Redis 键的 TTL(以秒为单位)。当 `policy` 为 `redis` 或 `redis-cluster` 时使用。 | -| rejected_code | integer | 否 | 503 | [200,...,599] | 请求因超出阈值而被拒绝时返回的 HTTP 状态代码。| -| rejection_msg | string | 否 | | 非空 | 请求因超出阈值而被拒绝时返回的响应主体。| +| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 | +|--|--||||--| +| conn | integer | 否 | | > 0 | 允许的最大并发请求数。超过配置的限制且低于 `conn + burst` 的请求将被延迟。如果未配置 `rules`,则为必填项。| +| burst | integer | 否 | | >= 0 | 允许延迟的过多并发请求数。超过 `conn + burst` 的请求将被立即拒绝。如果未配置 `rules`,则为必填项。|
Re: [PR] docs(limit-conn): re-port with Admin API, ADC, and Ingress Controller tabs [apisix]
kayx23 commented on PR #13215: URL: https://github.com/apache/apisix/pull/13215#issuecomment-4250419284 I found a few remaining doc mismatches in this PR: 1. `default_conn_delay` is still described incorrectly in the attribute table in both EN and ZH docs. It currently says it applies to concurrent requests exceeding `conn + burst`, but the implementation rejects requests at `conn + burst` and only delays requests after `conn` is exceeded. 2. `burst` and `rules.burst` are still described as applying "per second". That wording is misleading for `limit-conn`, since this plugin limits concurrent requests rather than a time-windowed request rate. 3. The Redis cluster docs are still internally inconsistent: the attribute table now says `redis_cluster_nodes` needs at least one address, but the Redis cluster example prose still says a minimum of two nodes is required for the plugin configuration. Implementation references: - `apisix/plugins/limit-conn/util.lua` - `apisix/utils/redis-schema.lua` -- 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]
Re: [PR] docs(limit-conn): re-port with Admin API, ADC, and Ingress Controller tabs [apisix]
kayx23 commented on PR #13215: URL: https://github.com/apache/apisix/pull/13215#issuecomment-4249827013 Please correct `default_conn_delay` explanation in this doc -- 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]
