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