You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/09/04 06:18:44 UTC

[GitHub] [apisix] lunarwhite opened a new pull request, #7857: docs(plugin): refactor limit-conn.md

lunarwhite opened a new pull request, #7857:
URL: https://github.com/apache/apisix/pull/7857

   ### Description
   
   update documents under `docs/zh/latest/plugins/` along with `docs/en/latest/plugins/`
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tzssangglass commented on a diff in pull request #7857: docs(plugin): refactor limit-conn.md

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #7857:
URL: https://github.com/apache/apisix/pull/7857#discussion_r964434582


##########
docs/en/latest/plugins/limit-conn.md:
##########
@@ -99,19 +100,17 @@ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
-<!-- ![enable limit-conn plugin](https://raw.githubusercontent.com/apache/apisix/master/docs/assets/images/plugin/limit-conn-1.png) -->
-
 ## Example usage
 
 The example above configures the Plugin to only allow one concurrent request. When more than one request is received, the Plugin will respond with a 503 status code:

Review Comment:
   also need to change English



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY merged pull request #7857: docs(plugin): refactor limit-conn.md

Posted by GitBox <gi...@apache.org>.
SylviaBABY merged PR #7857:
URL: https://github.com/apache/apisix/pull/7857


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7857: docs(plugin): refactor limit-conn.md

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7857:
URL: https://github.com/apache/apisix/pull/7857#discussion_r962393958


##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -1,5 +1,10 @@
 ---
 title: limit-conn
+keywords:
+  - APISIX
+  - API 网关
+  - Limit Connection
+description: 本文介绍了 Apache APISIX limit-conn 插件的相关操作,你可以使用此插件限制对你的服务的并发请求数。

Review Comment:
   ```suggestion
   description: 本文介绍了 Apache APISIX limit-conn 插件的相关操作,你可以使用此插件限制服务的并发请求数。
   ```



##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -209,3 +185,22 @@ Server: APISIX/2.15.0
 </body>
 </html>
 ```
+
+## 移除插件

Review Comment:
   ```suggestion
   ## 禁用插件
   ```



##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -169,7 +155,7 @@ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 
 上述路由在 `/ws` 上开启了 WebSocket 代理,并限制了 WebSocket 连接并发数为 1,超过 1 个并发的 WebSocket 连接将返回 `503` 拒绝请求。
 
-2、发起 WebSocket 请求,连接建立成功
+2、发起 WebSocket 请求,返回 `101` HTTP 状态码表示连接建立成功:

Review Comment:
   ```suggestion
   2、发起 WebSocket 请求,返回 `101` HTTP 状态码表示连接建立成功。
   ```



##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -115,36 +122,15 @@ curl -i http://127.0.0.1:9080/index.html?sleep=20
 </html>
 ```
 
-这就表示 limit-conn 插件生效了。
-
-## 移除插件
-
-当你想去掉 limit-conn 插件的时候,很简单,在插件的配置中把对应的 json 配置删除即可,无须重启服务,即刻生效:
-
-```shell
-curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
-{
-    "methods": ["GET"],
-    "uri": "/index.html",
-    "upstream": {
-        "type": "roundrobin",
-        "nodes": {
-            "127.0.0.1:1980": 1
-        }
-    }
-}'
-```
-
-现在就已经移除了 limit-conn 插件了。其他插件的开启和移除也是同样的方法。
-
 ## 限制 WebSocket 连接的并发数
 
 Apache APISIX 支持 WebSocket 代理,我们可以使用 `limit-conn` 插件限制 WebSocket 连接的并发数。
 
-1、创建路由并启用 WebSocket 代理和 `limit-conn` 插件
+1、创建路由并启用 WebSocket 代理和 `limit-conn` 插件:

Review Comment:
   ```suggestion
   1、创建路由并启用 WebSocket 代理和 `limit-conn` 插件。
   ```



##########
docs/en/latest/plugins/limit-conn.md:
##########
@@ -189,28 +168,39 @@ curl --include \
 
 ```shell
 HTTP/1.1 101 Switching Protocols
-Connection: upgrade
-Upgrade: websocket
-Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=
-Server: APISIX/2.15.0
-...
-````
+```
 
-3. Initiate the WebSocket request again in another terminal, the request will be rejected
+3. Initiate the WebSocket request again in another terminal, the request will be rejected.
 
-````shell
+```shell
 HTTP/1.1 503 Service Temporarily Unavailable
-Date: Mon, 01 Aug 2022 03:49:17 GMT
-Content-Type: text/html; charset=utf-8
-Content-Length: 194
-Connection: keep-alive
-Server: APISIX/2.15.0
-
+···
 <html>
 <head><title>503 Service Temporarily Unavailable</title></head>
 <body>
 <center><h1>503 Service Temporarily Unavailable</h1></center>
 <hr><center>openresty</center>
 </body>
 </html>
-````
+```
+
+## Disable Plugin
+
+To disable the `limit-conn` Plugin, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.
+
+```shell
+curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '

Review Comment:
   ```suggestion
   curl http://127.0.0.1:9180/apisix/admin/routes/1  \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   ```



##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -95,17 +102,17 @@ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
-你也可以通过 web 界面来完成上面的操作,先增加一个 route,然后在插件页面中添加 limit-conn 插件:
-![enable limit-conn plugin](../../../assets/images/plugin/limit-conn-1.png)
-
 ## 测试插件
 
-上面启用的插件的参数表示只允许一个并发请求。 当收到多个并发请求时,将直接返回 503 拒绝请求。
+按上述配置启用插件后,服务只允许一个并发请求,当收到多个并发请求时,将直接返回 `503` HTTP 状态码,拒绝请求。

Review Comment:
   ```suggestion
   按上述配置启用插件后,服务将只允许一个并发请求;当收到多个并发请求时,将直接返回 `503` HTTP 状态码,拒绝请求。
   ```



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] hf400159 commented on a diff in pull request #7857: docs(plugin): refactor limit-conn.md

Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #7857:
URL: https://github.com/apache/apisix/pull/7857#discussion_r962430403


##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -23,28 +28,29 @@ title: limit-conn
 
 ## 描述
 
-限制并发请求(或并发连接)插件。
+`limit-conn` 插件用于限制对服务的并发请求数。

Review Comment:
   ```suggestion
   `limit-conn` 插件用于限制客户端对服务的并发请求数。
   ```



##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -23,28 +28,29 @@ title: limit-conn
 
 ## 描述
 
-限制并发请求(或并发连接)插件。
+`limit-conn` 插件用于限制对服务的并发请求数。
 
 ## 属性
 
 | 名称               | 类型    | 必选项   | 默认值 | 有效值                                                                                    | 描述                                                                                                                                                                                                       |
 | ------------------ | ------- | -------- | ------ | ----------------------------------------------------------------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
 | conn               | integer | 是 |        | conn > 0                                                                                  | 允许的最大并发请求数。超过 `conn` 的限制、但是低于 `conn` + `burst` 的请求,将被延迟处理。                                                                                                                                               |
-| burst              | integer | 是 |        | burst >= 0                                                                                | 允许被延迟处理的并发请求数。                                                                                                                                                                                           |
+| burst              | integer | 是 |        | burst >= 0                                                                                | 每秒允许被延迟处理的额外并发请求数。                                                                                                                                                                                           |
 | default_conn_delay | number  | 是 |        | default_conn_delay > 0                                                                    | 默认的典型连接(或请求)的处理延迟时间。                                                                                                                                                                                     |
-| only_use_default_delay  | boolean | 否 | false  | [true,false]                                                                              | 延迟时间的严格模式。 如果设置为`true`的话,将会严格按照设置的时间来进行延迟                                                                                                                                                                |
-| key_type      | string | 否   |  "var"      | ["var", "var_combination"]                                          | key 的类型                                                                                                                                                                                                  |
-| key           | string  | 是   |        |  | 用来做请求计数的依据。如果 `key_type` 为 "var",那么 key 会被当作变量名称,如 "remote_addr" 和 "consumer_name"。如果 `key_type` 为 "var_combination",那么 key 会当作变量组合,如 "$remote_addr $consumer_name"。如果 key 的值为空,$remote_addr 会被作为默认 key。 |
-| rejected_code      | string  | 否 | 503    | [200,...,599]                                                                             | 当请求超过 `conn` + `burst` 这个阈值时,返回的 HTTP 状态码                                                                                                                                                                |
-| rejected_msg       | string | 否                                |            | 非空                                          | 当请求超过 `conn` + `burst` 这个阈值时,返回的响应体。                                                                                                                                                                     |
-| allow_degradation              | boolean  | 否                                | false       |                                                                     | 当插件功能临时不可用时是否允许请求继续。当值设置为 true 时则自动允许请求继续,默认值是 false。                                                                                                                                                    |
+| only_use_default_delay  | boolean | 否 | false  | [true,false]                                                                              | 延迟时间的严格模式。 当设置为 `true` 时,将会严格按照设置的 `default_conn_delay` 时间来进行延迟处理。                                                                                                                                                                |
+| key_type      | string | 否   |  "var"      | ["var", "var_combination"]                                          | `key` 的类型                                                                                                                                                                                                  |
+| key           | string  | 是   |        |  | 用来做请求计数的依据。如果 `key_type` 为 `"var"`,那么 `key` 会被当作变量名称,如 `remote_addr` 和 `consumer_name`;如果 `key_type` 为 `"var_combination"`,那么 `key` 会当作变量组合,如 `$remote_addr $consumer_name`;如果 `key` 的值为空,`$remote_addr` 会被作为默认 `key`。 |
+| rejected_code      | string  | 否 | 503    | [200,...,599]                                                                             | 当请求数超过 `conn` + `burst` 阈值时,返回的 HTTP 状态码。                                                                                                                                                                |
+| rejected_msg       | string | 否                                |            | 非空                                          | 当请求数超过 `conn` + `burst` 阈值时,返回的响应体。                                                                                                                                                                     |
+| allow_degradation              | boolean  | 否                                | false       |                                                                     | 当插件功能临时不可用时是否允许请求继续。当设置为 `true` 时,启用插件降级并自动允许请求继续。                                                                                                                                                    |

Review Comment:
   ```suggestion
   | allow_degradation              | boolean  | 否                                | false       |                                                                     | 当设置为 `true` 时,启用插件降级并自动允许请求继续。                                                                                                                                                    |
   ```



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tzssangglass commented on a diff in pull request #7857: docs(plugin): refactor limit-conn.md

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #7857:
URL: https://github.com/apache/apisix/pull/7857#discussion_r963227759


##########
docs/zh/latest/plugins/limit-conn.md:
##########
@@ -95,17 +102,17 @@ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
-你也可以通过 web 界面来完成上面的操作,先增加一个 route,然后在插件页面中添加 limit-conn 插件:
-![enable limit-conn plugin](../../../assets/images/plugin/limit-conn-1.png)
-
 ## 测试插件
 
-上面启用的插件的参数表示只允许一个并发请求。 当收到多个并发请求时,将直接返回 503 拒绝请求。
+按上述配置启用插件后,服务将只允许一个并发请求;当收到多个并发请求时,将直接返回 `503` HTTP 状态码,拒绝请求。

Review Comment:
   ```suggestion
   按上述配置启用插件后,在这条路由资源上,APISIX 将只允许一个连接;当有更多连接进入时,APISIX 会直接返回 `503` HTTP 状态码,拒绝连接。
   ```



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org