Nacos version:1.1.3
client version:1.0.0git
dependency: 'org.springframework.cloud:spring-cloud-alibaba-nacos-config:0.9.0.RELEASE'github
description as below:spring
NacosConfigService will be rebuilt every time the configuration file is changed in the console. After hundreds of configuration changes, the CPU will burst due to too many ClientWorker threads created.The NacosConfigService classe is not manually created。ui
Maybe problem is in the class org.springframework.cloud.alibaba.nacos.NacosConfigProperties,because springcloud will refresh class with annotation @ConfigurationProperties,this class will be rebuilt after every refresh phase.this
详情可参考 issue :https://github.com/alibaba/spring-cloud-alibaba/issues/912线程
问题简单点描述为:使用了org.springframework.cloud:spring-cloud-alibaba-nacos-config:0.9.0.RELEASE 客户端,在持续刷新配置文件的状况下会形成cpu 100%。3d
缘由是由于在springcloud refresh environment的时候,NacosConfigService 会重复建立,NacosConfigService中包含了几个定时任务的线程(名为:com.alibaba.nacos.client.Workder.fixed-***),在屡次修改(线上慢慢积累)配置文件后,积累的的Worker线程会耗费掉cpu资源。blog
解决办法:hold住 NacosConfigService实例,在刷新的时候不去建立新的类。注意:naming模块也有相同的问题,解决办法相同。ip