Hystrix 默认加载的配置文件 - 限流、 熔断示例

Hystrix 默认加载的配置文件 - 限流、 熔断示例
#线程池的大小
Hystrix.threadpool.default.coreSize=1
#缓冲区大小,如果为-1则不缓冲,直接进行降级 fallback
hystrix.threadpool.default.maxQueueSize=200
#缓冲区的阈值,超限则直接降级
hystrix.threadpool.default.queueSizeRejectionThreshold=2

#执行策略
#资源隔离模式,默认thread,还有一种叫信号量
hystrix.command.default.execution.isolation.strategy=THREAD
#是否打开超时
hystrix.command.default.execution.timeout.enabled=true
#超时时间 默认1000毫秒
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=2000

超时时中断线程
hystrix.command.default.execution.isolation.thread.interruptOnTimeout=true
#取消的时候中断进程
hystrix.command.default.execution.isolation.thread.interruptOnFutureCancel=false
#信号量模式下,最大并发量
hystrix.command.default.execution.isolation.semaphore.maxConcurrentRequests=2

#降级策略
#是否开启服务降级
hystrix.command.default.fallback.enabled=true
#fallback执行并发量
hystrix.command.default.fallback.isolation.semaphore.maxConcurrentRequests=100

#熔断策略
#启用禁用熔断机制
hystrix.command.default.circuitBreaker.enabled=true
#强制开启熔断
hystrix.command.default.circuitBreaker.forceOpen=false
#强制关闭熔断
hystrix.command.default.circuitBreaker.forceClosed=false
#前置条件,一定数量内发起一定数量的请求。也就是5秒钟之内(这个5秒对应下面的滚动窗口长度)至少请求3次 ,熔断器才发挥作用。总数默认20
hystrix.command.default.circuitBreaker.requestVolumeThreshold=3
#错误百分比。达到或超过这个数量的百分比,熔断器打开
hystrix.command.default.circuitBreaker.errorThresholdPercentage=50
#10秒后,进入半打开状态(熔断开启,间隔一段时间后,会让一部分的命令去请求服务提供者,如果结果依旧是失败,则又会进入熔断状态,如果成功就关闭熔断器)。默认5秒
hystrix.command.default.circuitBreaker.sleepWindowInMilliseconds=10000

#度量策略
#5秒内为一次统计周期,术语描述:滚动窗口的长度为5秒
hystrix.command.default.metrics.rollingStats.timeInMilliseconds=5000
#统计周期内,度量桶的数量,必须被timeMilliseconds整除,
hystrix.command.default.metrics.rollingStats.numBuckets=10
#是否收集执行时间,并计算各个时间段的百分比
hystrix.command.default.metrics.rollingPercentile.enabled=true
#设置执行时间统计周期为多久,用来计算百分比
hystrix.command.default.metrics.rollingPercentile.timeInMilliseconds=60000
#执行时间统计周期内,每个度量桶最多统计多少条记录,设置为50,有100次请求,则只会统计最近的10次
hystrix.command.default.metrics.rollingPercentile.bucketSize=100
#数据取样时间间隔
hystrix.command.default.metrics.healthSnapshot.intervalInMilliseconds=500
#设置是否缓存请求,request-scope内缓存
hystrix.command.default.requestCache.enabled=false
#设置HystrixCommand执行和事件是否打印到HystrixRequestLog中
hystrix.command.default.requestLog.enabled=false

######DnUser-ThreadPool特定配置
————————————————
版权声明:本文为CSDN博主「皮皮小龙」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_38191833/article/details/88831256

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值