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

    一般生产环境无需修改
     
     
  • 相关阅读:
    Mongo Windows 基本使用入门
    ASP.NET Web API 使用Swagger使用笔记
    Smtp协议与Pop3协议的简单实现
    详解boost库中的Message Queue .
    Bencode编码解析的C++实现
    pugixml使用教程
    在QT中使用Irrlicht引擎的方法与步骤
    七大查找算法
    java保留小数点两位的4种方法
    [Node] nvm 安装 node 和 npm
  • 原文地址:https://www.cnblogs.com/zou-rong/p/12597044.html
Copyright © 2011-2022 走看看