启动后如何减少尤里卡CPU的消耗?

时间:2019-05-21 10:26:38

标签: spring amazon-web-services amazon-ec2 netflix-eureka

我的aew ec2实例中运行的是eureka服务器,成功启动后,我看到永久CPU负载约为15-20%,我希望它应该为零,因为我只注册了3个服务。

我使用了eureka教程,并尝试通过删除所有我不了解但到目前为止还不走运的东西来处理application.yml文件。

== application.yml ==

Select crawl_post.Id,
count(distinct crawl_image.Id) as 'downloaded image',
count(distinct crawl_video.Id) as 'downloaded video'
from crawl_post 
join crawl_image on crawl_post.Id=crawl_image.PostId
join crawl_video on crawl_post.Id=crawl_video.PostId
where crawl_image.Status = 1 and crawl_video.Status=1
group by crawl_post.Id;

我使用Java 1.8。

== build.gradle ==

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/

我在日志中看到以下几行:

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"
}

最有可能我在配置中缺少了一些东西,但是不知道在google中是什么,到目前为止我还没有找到相关的提示/设置。有人可以建议吗?

1 个答案:

答案 0 :(得分:0)

问题是我在任务定义的运行状况检查命令中使用了流程启动。在我纠正了这一疏忽之后,问题就消失了。