zookeeper 注册接口速度很慢。每一个接口越5秒,请教

zookeeper 注册接口速度很慢。每一个接口越5秒,请教

问题描述:

首先是平台为macOS 10.12

ide为eclipse,项目搭载到tomcat7.0
项目为java-web

zookeeper使用为 3.4.6 (尝试过最新3.5.2)
zoo.cfg配置为

The number of milliseconds of each tick
tickTime=2000
The number of ticks that the initial
synchronization phase can take
initLimit=10
The number of ticks that can pass between
sending a request and getting an acknowledgement
syncLimit=5
the directory where the snapshot is stored.
do not use /tmp for storage, /tmp here is just
example sakes.
dataDir=/Users/yukaiji/Documents/tmp/ttehui
the port at which the clients will connect
clientPort=2181
the maximum number of client connections.
increase this if you need to handle more clients
maxClientCnxns=60

Be sure to read the maintenance section of the
administrator guide before turning on autopurge.

http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

The number of snapshots to retain in dataDir
autopurge.snapRetainCount=3
Purge task interval in hours
Set to "0" to disable auto purge feature
autopurge.purgeInterval=1

hosts 设置为本机 ip 本机名称
zkSever.sh. 启动正常。 日志文件 无错误,jps查看端口正常。
zkCli.sh. 启动 约 5 秒
目前认为是重点,配置文件反复看了很多次了。 2181 端口正常
启动java-web项目,在注册dubbo接口(managerService)的时候,一个大约5秒钟。
图片说明
在win环境下 启动项目整体约30秒,现在启动是两分钟多点。排查了一天半,不清楚因为什么。
日志信息就是在dubbo接口注册的时候非常慢。
这里还有个问题需要请教,每一个接口的注册,都需要重新连接zookeeper吗?因为每一个接口间隔5s 很均匀。

在这里向各位请教。不胜感激。新入门没有币

还请各位帮忙提点一下。万分感谢。我在百度没有找到相关问题。
明天会把日志贴出来。(配置文件和日志已经看烂)

整个项目在运行时,只有dubbo的service接口注册的时候很慢,每5秒钟一条。

万分感谢!

遇到的同样的问题,请问楼主解决了吗?

我这是mac 10.12+idea+jetty9 dubbo服务注册到zk也是5秒一个,从原来的几十秒,飙升到了3分半钟。换了一台非本机器的zk地址也是一样慢。怀疑是mac系统防火墙哪配置又问题

楼主有解决这个问题吗,我也遇到了

楼主解决了吗我也遇到了

经过debug,发觉是dubbo
com.alibaba.dubbo.config.ServiceConfig类获取host的代码卡住了5秒
if (NetUtils.isInvalidLocalHost(host)) {
anyhost = true;
try {
# host = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
logger.warn(e.getMessage(), e);
}
。。。

请检查vi /etc/hosts 文件127.0.0.0 对应的host名称是否正确。我本机是错误的(因为操作系统升级会改变host名称)
127.0.0.1 your_host_name

另外可以参考:记一次本机InetAddress.getLocalHost()引起的项目启动变慢及解决过程

有一种情况可能出现这种问题,debug模式下,端点没有去掉,就启动了
会导致,在注册service时,很慢。基本是5秒一个service