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

    一般生产环境无需修改
     
     
  • 相关阅读:
    BZOJ 4032: [HEOI2015]最短不公共子串 (dp*3 + SAM)
    后缀自动机详解!
    BZOJ 3926: [Zjoi2015]诸神眷顾的幻想乡(广义后缀自动机 多串)
    BZOJ 3938 Robot
    [JSOI2008]Blue Mary开公司
    [ZJOI2017]树状数组
    [JSOI2015]非诚勿扰
    [HNOI2011]任务调度
    BZOJ 3680 吊打XXX
    POJ 3318 Matrix Multiplication
  • 原文地址:https://www.cnblogs.com/zou-rong/p/12597044.html
Copyright © 2011-2022 走看看