简体   繁体   English

Spring Cloud Consul高CPU在Spring Boot应用程序中

[英]spring cloud consul high cpu in a spring boot application

I setup a Spring boot application with @EnableDiscoveryClient and using Consul as the cloud provider. 我使用@EnableDiscoveryClient并使用Consul作为云提供商来设置Spring引导应用程序。 I noticed that this generates high cpu consumption due to ConsulCatalogWatch.catalogServicesWatch . 我注意到由于ConsulCatalogWatch.catalogServicesWatch ,这会产生很高的cpu消耗。 Looking at the code, I noticed that the annotation 查看代码,我注意到该注释

@Scheduled(fixedDelayString = "${spring.cloud.consul.discovery.catalogServicesWatchDelay:10}")

will cause this method to be call at a very high rate. 将导致以很高的速率调用此方法。 Does anyone have met this and am I missing something ? 有人遇到过这个吗,我想念什么吗?

As a workaround, set spring.cloud.consul.discovery.catalogServicesWatchDelay=30000 . 解决方法是,设置spring.cloud.consul.discovery.catalogServicesWatchDelay=30000

Fixed via issue 94 . 已通过问题94解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM