spacewander commented on a change in pull request #6562:
URL: https://github.com/apache/apisix/pull/6562#discussion_r823255767



##########
File path: conf/config-default.yaml
##########
@@ -450,4 +450,8 @@ plugin_attr:
       sequence_bits: 10               # each machine generates a maximum of (1 
<< sequence_bits) serial numbers per millisecond
       data_machine_ttl: 30            # live time for data_machine in etcd 
(unit: second)
       data_machine_interval: 10       # lease renewal interval in etcd (unit: 
second)
-
+  #proxy-mirror:

Review comment:
       What about uncommenting them and setting a default timeout (60000)?

##########
File path: conf/config-default.yaml
##########
@@ -450,4 +450,8 @@ plugin_attr:
       sequence_bits: 10               # each machine generates a maximum of (1 
<< sequence_bits) serial numbers per millisecond
       data_machine_ttl: 30            # live time for data_machine in etcd 
(unit: second)
       data_machine_interval: 10       # lease renewal interval in etcd (unit: 
second)
-
+  #proxy-mirror:
+  #timeout:           # proxy timeout inmirrored sub-request (unit: 
milliseconds)

Review comment:
       ```suggestion
     #timeout:           # proxy timeout in mirrored sub-request (unit: 
milliseconds)
   ```

##########
File path: docs/zh/latest/plugins/proxy-mirror.md
##########
@@ -93,3 +93,22 @@ 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` 中指定子请求的超时时间。这在连接复用的场景下 mirror 
流量到一个非常慢的后端服务时非常有用。
   ```

##########
File path: apisix/cli/ngx_tpl.lua
##########
@@ -765,6 +765,18 @@ http {
             }
             {% end %}
 
+
+            {% if proxy_mirror_timeouts then %}
+                {% if proxy_mirror_timeouts.connect then %}
+            proxy_connect_timeout {* proxy_mirror_timeouts.connect *}ms;

Review comment:
       Would be better to put the time unit in the configuration value instead 
of hardcoded it.

##########
File path: docs/en/latest/plugins/proxy-mirror.md
##########
@@ -94,3 +94,22 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 
'X-API-KEY: edd1c9f034335f1
 ```
 
 The plugin has been disabled now.
+
+## Customize proxy timeout for mirrored sub-request
+
+We can customize proxy timeout for the mirrored sub-request in the 
`plugin_attr` of `conf/config.yaml`. This useful while mirroring traffic to a 
slow backend in a connection reused scenario.

Review comment:
       ```suggestion
   We can customize proxy timeouts for the mirrored sub-request in the 
`plugin_attr` of `conf/config.yaml`. This is useful while mirroring traffic to 
a slow backend in a long connection scenario.
   ```




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


Reply via email to