hystrix全局默认配置

@HystrixCommand 注解是hystrix框架中非常重要的一个注解。作用于方法上,为每个方法开启熔断、降级。
全局设置熔断的方式:在类上面添加@DefaultProperties(defaultFallback = “default_global”) defaultFallback的意思是,添加了@HystrixCommand的方法出发降级都会调用default_global方法。
hystrix 框架默认是开启请求超时时间的,如果不进行配置采用默认配置的话,超时时间为1秒钟。
全局配置的方式:
#统计的时间窗口,默认为10s,一般不需要更改
#hystrix.command.default.metrics.rollingStats.timeInMilliseconds: 10000
#是否开启降级
#hystrix.command.default.fallback.enabled: true
#是否开启断路器
#hystrix.command.default.circuitBreaker.enabled: true
#失败率达到多少后跳闸,在统计窗口期中,请求数大于阈值并且失败率达到60,则触发断路,断路器开启,链路中断
#hystrix.command.default.circuitBreaker.errorThresholdPercentage: 60
#请求最小触发次数
#hystrix.command.default.circuitBreaker.requestVolumeThreshold: 3
#断路后休眠状态的时长,默认为5s,断路8s后断路器进入半开状态
#hystrix.command.default.circuitBreaker.sleepWindowInMilliseconds: 10000
#取消是否中断
#hystrix.command.default.execution.isolation.thread.interruptOnFutureCancel: true
#超时是否中断
#hystrix.command.default.execution.isolation.thread.interruptOnTimeout: true
#超时阈值,单位是毫秒
#hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 4000

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值