SpringCloud学习–基础–4.3–Hystrix–配置
代码位置
https://gitee.com/DanShenGuiZu/learnDemo/tree/master/SpringCloud-learn/SpringCloud-learn/demo_service_invocation
1、常用配置
# 服务提供者的超时时间,2秒,如果请求服务提供者超过2秒,就服务降级和线程隔离
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=2000
# 熔断配置
# 10次请求有9次是失败,就熔断,熔断后,每隔6秒,就打开半开状态
# 如果半开状态,能访问服务提供者,关闭熔断,否则每隔6秒进行检测
hystrix.circuitBreaker.errorThresholdPercentage=90 # 触发熔断错误比例阈值,默认值50%
hystrix.circuitBreaker.sleepWindowInMilliseconds=6000 # 熔断后休眠时长,默认值5秒%
hystrix.circuitBreaker.requestVolumeThreshold=10 # 熔断触发最小请求次数,默认值是20%