美文网首页
16.Hystrix -电商系统集成Hystrix(配置文件级别

16.Hystrix -电商系统集成Hystrix(配置文件级别

作者: 溅十三 | 来源:发表于2020-06-07 17:30 被阅读0次

1.@HystrixCommand方式呢,很污染代码,将Hystrix的配置装移到yaml当中

loginFail与登录的降级熔断一致,一一对应就好

hystrix:
  command:
    # 有的属性是默认值,写不写都行
    default:
      fallback:
        enabled: true
      circuitBreaker:
        enabled: true
        # 超过50%错误,那么开启熔断
        errorThresholdPercentage: 50
        # 5个request之后才进行统计
        requestVolumeThreshold: 5
        # 10秒之后进入半开状态
        sleepWindowInMilliseconds: 10000
        # forceClosed, forceOpen 强制关闭/开启熔断开关
      execution:
        timeout:
          enabled: true
        # 可以指定隔离方式是线程池还是信号量
        isolation:
          thread:
            interruptOnTimeout: true
            interruptOnFutureCancel: true
            timeoutInMilliseconds: 10000
      metrics:
        rollingStats:
          # 时间窗口统计
          timeInMilliseconds: 20000
          # numBuckets: 10
    #        rollingPercentile:
    #          # 时间窗口统计
    #          timeInMilliseconds: 20000
    #          # numBuckets: 10
    #          bucketSize: 300
    # 照这个方法,覆盖其他的属性
    loginFail:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 3000

相关文章

网友评论

      本文标题:16.Hystrix -电商系统集成Hystrix(配置文件级别

      本文链接:https://www.haomeiwen.com/subject/fqgctktx.html