Spring 启动后如何降低eureka CPU消耗?
我在aws ec2实例中运行了eureka服务器,在成功启动后,我看到永久CPU负载约为15-20%,我预计应该是零,因为我只注册了3个服务 我使用eureka教程,并尝试通过删除所有我不理解的内容来使用application.yml文件,但到目前为止运气不佳 ==application.yml==Spring 启动后如何降低eureka CPU消耗?,spring,amazon-web-services,amazon-ec2,netflix-eureka,Spring,Amazon Web Services,Amazon Ec2,Netflix Eureka,我在aws ec2实例中运行了eureka服务器,在成功启动后,我看到永久CPU负载约为15-20%,我预计应该是零,因为我只注册了3个服务 我使用eureka教程,并尝试通过删除所有我不理解的内容来使用application.yml文件,但到目前为止运气不佳 ==application.yml== server: port: 8000 eureka: instance: preferIpAddress: true hostname: localhost clien
server:
port: 8000
eureka:
instance:
preferIpAddress: true
hostname: localhost
client:
registerWithEureka: false # telling the server not to register himself in the service
fetchRegistry: false
serviceUrl:
defaultZone : http://${eureka.instance.hostname}:${server.port}/eureka/
我使用Java1.8
==build.gradle==
buildscript {
ext {
springBootVersion = '2.0.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'org.example.eureka'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
ext {
springCloudVersion = 'Finchley.SR1'
}
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-server')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
tasks.withType(Jar) {
archiveName = "eurekaserver.jar"
}
我在日志中看到以下行:
Running the evict task with compensationTime 0ms
很可能我在配置中遗漏了一些东西,但不知道是什么,因为在谷歌我还没有找到相关的提示/设置。有人能提供建议吗?问题是我在任务定义中使用了“在运行状况检查中启动流程”命令。在我修复了这个疏忽之后,问题就消失了