如何减少启动后的eureka CPU消耗?
How to reduce eureka CPU consumption after startup?
我的 aws ec2 实例中有尤里卡服务器 运行,在成功启动后,我看到永久 CPU 负载在 15-20% 左右,我希望它应该在零左右,因为我只有注册了 3 个服务。
我使用 eureka 教程并尝试通过删除所有我不明白的东西来玩 application.yml 文件,但到目前为止运气不好。
== application.yml ==
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
很可能我在配置中遗漏了一些东西,但不知道 google 中是什么,到目前为止我还没有找到相关的 hints/settings。谁能给点建议?
问题是我在任务定义中的健康检查命令中使用了进程启动。在我解决了这个疏忽之后,问题就消失了。
我的 aws ec2 实例中有尤里卡服务器 运行,在成功启动后,我看到永久 CPU 负载在 15-20% 左右,我希望它应该在零左右,因为我只有注册了 3 个服务。
我使用 eureka 教程并尝试通过删除所有我不明白的东西来玩 application.yml 文件,但到目前为止运气不好。
== application.yml ==
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
很可能我在配置中遗漏了一些东西,但不知道 google 中是什么,到目前为止我还没有找到相关的 hints/settings。谁能给点建议?
问题是我在任务定义中的健康检查命令中使用了进程启动。在我解决了这个疏忽之后,问题就消失了。