加快Netflix-Eureka注销速度不适用于Spring Boot [英] Speeding up Netflix-Eureka Unregistration not working for Spring Boot

查看:389
本文介绍了加快Netflix-Eureka注销速度不适用于Spring Boot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行有application.yml的尤里卡服务器

I have a eureka server running with the application.yml looking like

server:
  port: 8761 

eureka:
  client:
    registerWithEureka: false
    fetch-registry: false
  server:
    wait-time-in-ms-when-sync-empty:  5 
    enable-self-preservation: false

在客户端,我有

eureka:
  instance:
    prefer-ip-address: true
    lease-renewal-interval-in-seconds: 1
    lease-expiration-duration-in-seconds: 1

  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://localhost:8761/eureka

我专门放了

lease-renewal-interval-in-seconds: 1
lease-expiration-duration-in-seconds: 1

而不是默认的秒数的租约到期持续时间,即90.

instead of the default for lease-expiration-duration-in-seconds, which is 90.

但是,Eureka取消注册客户端大约需要30秒,这与默认情况下在没有等待时间的情况下注册客户端要花费的时间ms-when-sync-empty:5明确地添加到eureka服务器的application.yml

However, it takes closer to 30 seconds for Eureka to unregister the client, which is similar to how long it would take by default to register the client without the wait-time-in-ms-when-sync-empty: 5 explicitly added in the eureka server's application.yml

有没有办法加快注销过程?看来我的加速尝试没有奏效

Is there a way to speed up the unregistering process? It seems like my attempt to speed up is not working

推荐答案

有一个属性: evictionIntervalTimerInMs ,我们需要在服务器端进行配置.

There is one property: evictionIntervalTimerInMs which we need to configure at server side.

server:
    enableSelfPreservation: false
    evictionIntervalTimerInMs: 1000

这是要运行计划的作业,该作业将从eureka注册表中删除服务条目. 默认情况下为(60 * 1000)ms.将其减少到相当可观的毫秒数,它将按预期工作.

This is to run the scheduled job which removes the entry of service from eureka registry. By default it is (60 * 1000) ms. Reduce it to some considerable milliseconds it will work as expected.

服务租约一旦取消,它将在尤里卡的注册表中等待,直到下一个驱逐作业运行为止.因此,根据驱逐作业的最后运行时间,注册表中的服务条目可能会停留10、30、40..seconds.

Once the lease of your service is cancelled it will be waiting in the eureka's registry till the next eviction job runs. So based on the last run time of eviction job, service entry in registry may reside for 10, 30, 40..seconds.

我在调试库后发现了此属性.使用此属性,我可以得到预期的行为.希望这对您有用.

This property I found after debugging the library. With this property I was able to get the expected behavior. Hope this works for you.

这篇关于加快Netflix-Eureka注销速度不适用于Spring Boot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆