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%)

    一般生产环境无需修改
     
     
  • 相关阅读:
    Kubernetes笔记 (2)
    Kubernetes笔记(3)
    Kubernetes笔记 (1)
    《深入浅出React和Redux》(4)
    【从0安装】xshell和xftp
    【从0安装】Sourcetree
    postman测试需要登录的接口
    vue自定义滚动条组件-vuebar组件
    charles 抓包http 和 https
    pycharm 面板颜色调整和中文汉化
  • 原文地址:https://www.cnblogs.com/zou-rong/p/12597044.html
Copyright © 2011-2022 走看看