Yiyiyimu opened a new issue #4316:
URL: https://github.com/apache/apisix/issues/4316


   ### Issue description
   
   Just found adding 1s network delay between apisix and etcd could make all 
operation fails, although we set default etcd timeout to 30s. The reason is 
that there seems a default and non-configurable timeout context in the etcd, 
and it's around 5s. After that, it would just return the error `context 
deadline exceeded`.
   
   So no matter how large we add network delay to etcd, the put operation with 
grpc (test with `etcdctl`) would timeout at 5s, and RESTful API (test with 
`curl`) would timeout at 7s. However, when set etcd timeout (used in 
`lua-resty-http`) as 30s, we need to wait more time (30s) to get the returned 
error when for example, add a route to APISIX. So I think reducing the default 
timeout to 10s is enough for us, and we could remind users greater timeout 
would be no use.
   
   Here I list a `delay_time - process_time - error chart` for future reference
   
   <!--StartFragment-->
   network delay | grpc response time | restful response time | lua-resty-etcd 
response time | apisix response time | grpc error | restful error | 
lua-resty-etcd error | apisix error
   -- | -- | -- | -- | -- | -- | -- | -- | --
   0 | 0.026 | 0.014 | 0.004 | 0.008 | &nbsp; | &nbsp; | &nbsp; | &nbsp;
   50ms | 0.128 | 0.112 | 0.255 | 0.154 | &nbsp; | &nbsp; | &nbsp; | &nbsp;
   200ms | 0.427 | 0.412 | 1.00 | 1.00 | &nbsp; | &nbsp; | &nbsp; | &nbsp;
   500ms | 1.03 | 1.02 | 1.50 | 3.00 | &nbsp; | &nbsp; | &nbsp; | &nbsp;
   800ms | 5.02 | 7.01 | 7.80 | 8.60 | context deadline exceeded | etcdserver: 
request timed out | invalid response code: 500 | {"error_msg":"invalid response 
code: 503"}
   2s | 5.02 | 7.02 | 9.00 | 11.0 | context deadline exceeded | context 
deadline exceeded | invalid response code: 500 | {"error_msg":"invalid response 
code: 503"}
   10s | 5.02 | 7.01 | 30.0 | 38.0 | context deadline exceeded | context 
deadline exceeded | timeout | {"error_msg":"invalid response code: 503"} [from 
log] failed to fetch data from etcd: no route to host
   30s | 5.05 | 7.01 | &nbsp; | &nbsp; | context deadline exceeded | context 
deadline exceeded | [can not create etcd client] timeout | {"error_msg":"no 
route to host"}/{"error_msg":"timeout"}
   
   <!--EndFragment-->
   
   ### Environment
   
   Bug report without environment information will be ignored or closed.
   
   * apisix version (cmd: `apisix version`): docker latest version
   
   ### Minimal test code / Steps to reproduce the issue
   
   Just like #4315 
   


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to