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 2020/11/03 13:49:52 UTC

[GitHub] [apisix] spacewander commented on a change in pull request #2605: docs: sync English version

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



##########
File path: FAQ.md
##########
@@ -297,3 +297,27 @@ By default, APISIX only listens on port 9080 when handling HTTP requests. If you
     ```
 
 2. Reload or restart APISIX
+
+## How does APISIX use etcd to achieve millisecond-level configuration synchronization
+
+Etcd provides interfaces `wait` and `waitdir` to monitor whether the specified keywords and directories have changed, and return updated data if they have any changes.
+
+Take the `waitdir` interface as an example:
+
+`syntax: res, err = cli:waitdir(dir:string [, modified_index:uint [, timeout:uint] ])`
+
+The `timeout` parameter indicates the connection `timeout` seconds between the calling process and etcd.
+
+APISIX configuration of etcd long connection time is as follows:
+
+```yaml
+etcd:
+  host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
+    - "http://127.0.0.1:2379"     # multiple etcd address
+  prefix: "/apisix"               # apisix configurations prefix
+  timeout: 30                     # 30 seconds
+```
+
+APISIX uses the `waitdir` interface to monitor directory changes. The default configuration of timeout is `30` seconds, so APISIX calling process maintains a long connection with etcd for `30` seconds.
+
+If the listening directory is not updated when the APISIX process calls this function, the function returns directly, the long connection is maintained, and the calling process can handle other events. If there is data update within `30` seconds, etcd returns the update result through this function, the calling process handle updated data. If no data returned within `30` seconds, when the timeout period reaches 30 seconds, etcd returns a timeout message through this function, and the calling process handle timeout message, then call the waitdir function to monitor the specified directory again. APISIX realizes real-time configuration updates through the above process.

Review comment:
       "the calling process handle" -> "the calling process handles"
   "then call" -> "then calls"




----------------------------------------------------------------
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:
users@infra.apache.org