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/08/13 12:39:24 UTC

[GitHub] [apisix] lunarwhite opened a new pull request, #7667: docs(plugin): refactor proxy-mirror.md

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

   ### 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] SylviaBABY commented on a diff in pull request #7667: docs(plugin): refactor proxy-mirror.md

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


##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -59,29 +67,60 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+### 指定 mirror 子请求的超时时间

Review Comment:
   ```suggestion
   ### 指定镜像子请求的超时时间
   ```



##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -23,26 +28,29 @@ title: proxy-mirror
 
 ## 描述
 
-代理镜像插件,该插件提供了镜像客户端请求的能力。
+`proxy-mirror` 插件提供了镜像客户端请求的能力。

Review Comment:
   ```suggestion
   `proxy-mirror` 插件提供了镜像客户端请求的能力。流量镜像是将线上真实流量拷贝到镜像服务中,以便在不影响线上服务的情况下,对线上流量或请求内容进行具体的分析。
   ```



##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -59,29 +67,60 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+### 指定 mirror 子请求的超时时间
+
+我们可以在 `conf/config.yaml` 的 `plugin_attr` 中指定子请求的超时时间。这在连接复用的场景下 mirror 流量到一个非常慢的后端服务时非常有用。
+
+| 名称 | 类型 | 默认值 | 描述 |
+| --- | --- | --- | --- |
+| connect | string | 60s | 镜像请求到上游的连接超时时间。 |
+| read | string | 60s | 镜像请求到上游的读超时时间。 |
+| send | string | 60s | 镜像请求到上游的写超时时间。 |

Review Comment:
   ```suggestion
   | send | string | 60s | 镜像请求发送到上游的超时时间。 |
   ```



##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -59,29 +67,60 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+### 指定 mirror 子请求的超时时间
+
+我们可以在 `conf/config.yaml` 的 `plugin_attr` 中指定子请求的超时时间。这在连接复用的场景下 mirror 流量到一个非常慢的后端服务时非常有用。

Review Comment:
   ```suggestion
   我们可以在 `conf/config.yaml` 文件内的 `plugin_attr` 中指定子请求的超时时间。由于镜像请求是以子请求的方式实现,子请求的延迟将会导致原始请求阻塞,直到子请求完成,才可以恢复正常。因此可以配置超时时间,来避免子请求出现过大的延迟而影响原始请求。
   ```



-- 
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] lunarwhite commented on a diff in pull request #7667: docs(plugin): refactor proxy-mirror.md

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


##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -59,29 +67,60 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+### 指定 mirror 子请求的超时时间
+
+我们可以在 `conf/config.yaml` 的 `plugin_attr` 中指定子请求的超时时间。这在连接复用的场景下 mirror 流量到一个非常慢的后端服务时非常有用。

Review Comment:
   👍



-- 
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 #7667: docs(plugin): refactor proxy-mirror.md

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


##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -23,26 +28,29 @@ title: proxy-mirror
 
 ## 描述
 
-代理镜像插件,该插件提供了镜像客户端请求的能力。
+`proxy-mirror` 插件提供了镜像客户端请求的能力。
 
-注:镜像请求返回的响应会被忽略。
+:::note 注意
+
+镜像请求返回的响应会被忽略。
+
+:::
 
 ## 参数
 
 | 名称 | 类型   | 必选项 | 默认值 | 有效值 | 描述                                                                                                    |
 | ---- | ------ | ------ | ------ | ------ | ------------------------------------------------------------------------------------------------------- |
-| host | string | 必须   |        |        | 指定镜像服务地址,例如:http://127.0.0.1:9797(地址中需要包含 schema :http 或 https,不能包含 path 部分)|
-| path | string | 可选   |        |        | 指定镜像请求的路径。如不指定,当前路径将被使用。 |
-| sample_ratio | number | 可选    | 1       |  [0.00001, 1]     | 镜像请求采样率 |
-
-## 示例
+| host | string | 是   |        |        | 指定镜像服务的地址,地址中需要包含 `schema`(`http` 或 `https`),但不能包含 `path` 部分。例如 `http://127.0.0.1:9797`。 |
+| path | string | 否   |        |        | 指定镜像请求的路径。如果不指定,则默认会使用当前路径。 |
+| sample_ratio | number | 否    | 1       |  [0.00001, 1]     | 镜像请求的采样率。 |

Review Comment:
   ```suggestion
   | sample_ratio | number | 否    | 1       |  [0.00001, 1]     | 镜像请求的采样率。当设置为 `1` 时为全采样。 |
   ```



##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -59,29 +67,60 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+### 指定 mirror 子请求的超时时间
+
+我们可以在 `conf/config.yaml` 的 `plugin_attr` 中指定子请求的超时时间。这在连接复用的场景下 mirror 流量到一个非常慢的后端服务时非常有用。
+
+| 名称 | 类型 | 默认值 | 描述 |
+| --- | --- | --- | --- |
+| connect | string | 60s | 镜像请求到上游的连接超时时间。 |
+| read | string | 60s | 镜像请求到上游的读超时时间。 |
+| send | string | 60s | 镜像请求到上游的写超时时间。 |
+
+```yaml
+plugin_attr:
+  proxy-mirror:
+    timeout:
+      connect: 2000ms
+      read: 2000ms
+      send: 2000ms
+```
+
+## 测试插件
+
+:::tip 提示
+
+因为指定的镜像地址是 `127.0.0.1:9797`,所以验证此插件是否正常工作需要在端口为 `9797` 的服务上确认。
+
+我们可以通过 `python` 启动一个简单的 server:

Review Comment:
   ```suggestion
   我们可以通过 `python` 启动一个简单的服务:
   ```



-- 
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] lunarwhite commented on a diff in pull request #7667: docs(plugin): refactor proxy-mirror.md

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


##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -59,29 +67,60 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+### 指定 mirror 子请求的超时时间
+
+我们可以在 `conf/config.yaml` 的 `plugin_attr` 中指定子请求的超时时间。这在连接复用的场景下 mirror 流量到一个非常慢的后端服务时非常有用。
+
+| 名称 | 类型 | 默认值 | 描述 |
+| --- | --- | --- | --- |
+| connect | string | 60s | 镜像请求到上游的连接超时时间。 |
+| read | string | 60s | 镜像请求到上游的读超时时间。 |
+| send | string | 60s | 镜像请求到上游的写超时时间。 |
+
+```yaml
+plugin_attr:
+  proxy-mirror:
+    timeout:
+      connect: 2000ms
+      read: 2000ms
+      send: 2000ms
+```
+
+## 测试插件
+
+:::tip 提示
+
+因为指定的镜像地址是 `127.0.0.1:9797`,所以验证此插件是否正常工作需要在端口为 `9797` 的服务上确认。
+
+我们可以通过 `python` 启动一个简单的 server:

Review Comment:
   What's your suggestion? Shall we remove this step?



-- 
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 #7667: docs(plugin): refactor proxy-mirror.md

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


##########
docs/en/latest/plugins/proxy-mirror.md:
##########
@@ -83,26 +83,27 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-## Example usage
+### Specify the timeout for mirror subrequests
 
-Once you have configured the Plugin as shown above, the requests made will be mirrored to the configured host.
+We can specify the `timeout` for subrequests in `plugin_attr` in `conf/config.yaml`. This is useful in connection reuse scenarios when mirroring traffic to a very slow backend service.
 
-```shell
-curl http://127.0.0.1:9080/hello -i
-```
-
-```shell
-HTTP/1.1 200 OK
-Content-Type: application/octet-stream
-Content-Length: 12
-Connection: keep-alive
-Server: APISIX web server
-Date: Wed, 18 Mar 2020 13:01:11 GMT
-Last-Modified: Thu, 20 Feb 2020 14:21:41 GMT
+| Name | Type | Default | Description |
+| --- | --- | --- | --- |
+| connect | string | 60s | Connection timeout for mirror request to upstream. |
+| read | string | 60s | Reading timeout for mirror request to upstream. |
+| send | string | 60s | Sending timeout for mirror requests to upstream. |

Review Comment:
   ```suggestion
   | send | string | 60s | The time that APISIX maintains the connection with the mirror server; if APISIX does not send a request within this time, the connection is closed. |
   ```



-- 
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 #7667: docs(plugin): refactor proxy-mirror.md

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


##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -59,29 +67,60 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+### 指定 mirror 子请求的超时时间
+
+我们可以在 `conf/config.yaml` 的 `plugin_attr` 中指定子请求的超时时间。这在连接复用的场景下 mirror 流量到一个非常慢的后端服务时非常有用。
+
+| 名称 | 类型 | 默认值 | 描述 |
+| --- | --- | --- | --- |
+| connect | string | 60s | 镜像请求到上游的连接超时时间。 |
+| read | string | 60s | 镜像请求到上游的读超时时间。 |
+| send | string | 60s | 镜像请求到上游的写超时时间。 |
+
+```yaml
+plugin_attr:
+  proxy-mirror:
+    timeout:
+      connect: 2000ms
+      read: 2000ms
+      send: 2000ms
+```
+
+## 测试插件
+
+:::tip 提示
+
+因为指定的镜像地址是 `127.0.0.1:9797`,所以验证此插件是否正常工作需要在端口为 `9797` 的服务上确认。
+
+我们可以通过 `python` 启动一个简单的 server:

Review Comment:
   I'm not sure if this partial operation is required. The steps for each user to start the service are different.



-- 
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 #7667: docs(plugin): refactor proxy-mirror.md

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


##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -59,29 +67,60 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+### 指定镜像子请求的超时时间
+
+我们可以在 `conf/config.yaml` 文件内的 `plugin_attr` 中指定子请求的超时时间。由于镜像请求是以子请求的方式实现,子请求的延迟将会导致原始请求阻塞,直到子请求完成,才可以恢复正常。因此可以配置超时时间,来避免子请求出现过大的延迟而影响原始请求。
+
+| 名称 | 类型 | 默认值 | 描述 |
+| --- | --- | --- | --- |
+| connect | string | 60s | 镜像请求到上游的连接超时时间。 |
+| read | string | 60s | 镜像请求到上游的读超时时间。 |

Review Comment:
   ```suggestion
   | read | string | 60s | APISIX 与镜像服务器维持连接的时间;如果在该时间内,APISIX 没有收到镜像服务器的响应,则关闭连接。 |
   ```



-- 
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 #7667: docs(plugin): refactor proxy-mirror.md

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


##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -59,29 +67,60 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+### 指定镜像子请求的超时时间
+
+我们可以在 `conf/config.yaml` 文件内的 `plugin_attr` 中指定子请求的超时时间。由于镜像请求是以子请求的方式实现,子请求的延迟将会导致原始请求阻塞,直到子请求完成,才可以恢复正常。因此可以配置超时时间,来避免子请求出现过大的延迟而影响原始请求。
+
+| 名称 | 类型 | 默认值 | 描述 |
+| --- | --- | --- | --- |
+| connect | string | 60s | 镜像请求到上游的连接超时时间。 |
+| read | string | 60s | 镜像请求到上游的读超时时间。 |

Review Comment:
   also change the en



-- 
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 #7667: docs(plugin): refactor proxy-mirror.md

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


##########
docs/zh/latest/plugins/proxy-mirror.md:
##########
@@ -59,29 +67,60 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+### 指定 mirror 子请求的超时时间
+
+我们可以在 `conf/config.yaml` 的 `plugin_attr` 中指定子请求的超时时间。这在连接复用的场景下 mirror 流量到一个非常慢的后端服务时非常有用。
+
+| 名称 | 类型 | 默认值 | 描述 |
+| --- | --- | --- | --- |
+| connect | string | 60s | 镜像请求到上游的连接超时时间。 |
+| read | string | 60s | 镜像请求到上游的读超时时间。 |
+| send | string | 60s | 镜像请求到上游的写超时时间。 |

Review Comment:
   ```suggestion
   | send | string | 60s | APISIX 与镜像服务器维持连接的时间;如果在该时间内,APISIX 没有发送请求,则关闭连接。 |
   ```



-- 
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 #7667: docs(plugin): refactor proxy-mirror.md

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


-- 
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