zrlw commented on issue #8993:
URL: https://github.com/apache/dubbo/issues/8993#issuecomment-938568861


   翻了一下连接zk出现超时前面的测试类的日志,用use registry as 
config-center为关键词查了同一日志内的其余25个zk连接耗时情况,除了第1个zk连接耗时470ms比较久之外,其余24个zk连接耗时都在40ms内,比如下面这个不过20多ms:
   ```
   2021-10-08T07:35:39.1812856Z [08/10/21 07:35:39:179 UTC] main  INFO 
deploy.DefaultApplicationDeployer:  [DUBBO] use registry as config-center: 
<dubbo:config-center highestPriority="false" 
id="config-center-zookeeper-127.0.0.1-36605" 
address="zookeeper://127.0.0.1:36605" protocol="zookeeper" port="36605" />, 
dubbo version: 3.0.4-SNAPSHOT, current host: 172.19.112.1
   《== 紧接着DefaultApplicationDeployer会执行getDynamicConfiguration方法开始连接zk
   2021-10-08T07:35:39.2028731Z [08/10/21 07:35:39:199 UTC] 
Curator-ConnectionStateManager-0  INFO curator.CuratorZookeeperClient:  [DUBBO] 
Curator zookeeper client instance initiated successfully, session id is 
100001a38dd0000, dubbo version: 3.0.4-SNAPSHOT, current host: 172.19.112.1
   《== zk连接创建完毕
   2021-10-08T07:35:39.2034461Z [08/10/21 07:35:39:199 UTC] main  INFO 
zookeeper.ZookeeperTransporter:  [DUBBO] No valid zookeeper client found from 
cache, therefore create a new client for url. 
   ```
   因此正常情况下设置3秒连接超时也够用。
   
   curator官方声明要兼容zk 3.4.13,需要用curator4.2.0,dubbo现在用的4.1.0。
   
   ZooKeeper Version 3.4.x Compatibility
   https://curator.apache.org/zk-compatibility-34.html
   
   ZooKeeper 3.4.x is now at end-of-life. Consequently, the latest versions of 
Curator have removed support for it. If you wish to use Curator with ZooKeeper 
3.4.x you should pin to version 4.2.x of Curator. Curator 4.2.x supports 
ZooKeeper 3.4.x ensembles in a soft-compatibility mode. To use this mode you 
must exclude ZooKeeper when adding Curator to your dependency management tool.
   
   Maven
   ```
   <dependency>
       <groupId>org.apache.curator</groupId>
       <artifactId>curator-recipes</artifactId>
       <version>4.2.0</version>
       <exclusions>
           <exclusion>
               <groupId>org.apache.zookeeper</groupId>
               <artifactId>zookeeper</artifactId>
           </exclusion>
       </exclusions>
   </dependency>
   ```


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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to