zoukankan      html  css  js  c++  java
  • Hystrix熔断

    Hystrix熔断状态机有三种状态,Closed,Open,Half Open,对应关闭,打开,半开

    关闭:请求可以正常通过,未触发降级,则一直处于关闭状态。

    打开:请求直接返回失败,默认最近20次请求,如果有50%及以上都出现了超时,则会转变为打开状态;打开状态默认持续5秒,此时快速响应失败。

    半开:当打开状态持续5秒之后就会转变为半开状态,此时会释放一部分请求,如果该部分请求访问成功则回归关闭状态,否则继续转为打开状态5秒,继续重试。

    this.circuitBreakerRequestVolumeThreshold = getProperty(propertyPrefix, key, "circuitBreaker.requestVolumeThreshold", builder.getCircuitBreakerRequestVolumeThreshold(), default_circuitBreakerRequestVolumeThreshold);
            this.circuitBreakerSleepWindowInMilliseconds = getProperty(propertyPrefix, key, "circuitBreaker.sleepWindowInMilliseconds", builder.getCircuitBreakerSleepWindowInMilliseconds(), default_circuitBreakerSleepWindowInMilliseconds);
            this.circuitBreakerErrorThresholdPercentage = getProperty(propertyPrefix, key, "circuitBreaker.errorThresholdPercentage", builder.getCircuitBreakerErrorThresholdPercentage(), default_circuitBreakerErrorThresholdPercentage);
    circuitBreaker.requestVolumeThreshold修改触发熔断判断的请求次数阈值,也就是默认20次这个值。(默认20次)
    circuitBreaker.sleepWindowInMilliseconds修改休眠窗时间,单位毫秒,也就是打开状态持续时间(默认5000毫秒,也就是5秒)
    circuitBreaker.errorThresholdPercentage误差阈值百分比,当统计请求失败次数所占比例达到这个百分比时,会触发熔断器打开。(默认50%)

    一般生产环境无需修改
     
     
  • 相关阅读:
    QT 小总结
    Qt Creator 中,如何更改h,cpp,ui的文件并不让ui失效
    设计模式全方面练习(1)
    设计模式 笔记 模版方法模式 Template Method
    设计模式 笔记 策略模式 Strategy
    设计模式 笔记 状态模式 State
    设计模式 笔记 观察者模式 Observer
    effective c++ 笔记 (49-52)
    设计模式 笔记 备忘录模式 Memento
    设计模式 笔记 中介者模式 Mediator
  • 原文地址:https://www.cnblogs.com/zou-rong/p/12597044.html
Copyright © 2011-2022 走看看