Java

Hystrix配置项详解

2020-03-22  本文已影响0人  黄大海

简介

组/前缀 配置项 默认值 说明
Execution execution.isolation.strategy THREAD 二选一 THREAD 或 SEMAPHORE
hystrix.command.default/ hystrix.command.HystrixCommandKey execution.isolation.thread.timeoutInMilliseconds 1000 调用超时时间设置,超时后触发fallback
execution.timeout.enabled true 是否启用超时机制
execution.isolation.thread.interruptOnTimeout true 超时后是否中断执行(只在THREAD模式下有效)
execution.isolation.thread.interruptOnCancel false 取消时是否中断执行(只在THREAD模式下有效)
execution.isolation.semaphore.maxConcurrentRequests 10 最大并发数,超过会被拒绝(只在SEMAPHORE模式下有效)
Fallback fallback.isolation.semaphore.maxConcurrentRequests 10 fallback最大并发数(不论Execution是什么模式,fallback都是SEMAPHORE模式)
hystrix.command.default/ hystrix.command.HystrixCommandKey fallback.enabled true 是否开启fallback功能
Circuit Breaker circuitBreaker.enabled true 是否开启断路器
hystrix.command.default/ hystrix.command.HystrixCommandKey circuitBreaker.requestVolumeThreshold 20 断路器开启的最小请求次数
circuitBreaker.sleepWindowInMilliseconds 5000 断路器开启后的维持时间,到时间后会处于半开状态放一个请求进来
circuitBreaker.errorThresholdPercentage 50 执行失败比例超过多少后开启断路
circuitBreaker.forceOpen false 是否强制开启断路器
circuitBreaker.forceClosed false 是否强制关闭断路器
Metrics metrics.rollingStats.timeInMilliseconds 10000 统计的时间窗口
hystrix.command.default/ hystrix.command.HystrixCommandKey metrics.rollingStats.numBuckets 10 统计时间窗口内的细分个数
metrics.rollingPercentile.enabled true 启用百分比直方图
metrics.rollingPercentile.timeInMilliseconds 60000 统计的时间窗口
metrics.rollingPercentile.numBuckets 6 统计时间窗口内的细分个数
metrics.rollingPercentile.bucketSize 100 没用。。
metrics.healthSnapshot.intervalInMilliseconds 500 HealthCounts 专用统计窗口(对断路器起作用)
Request Context requestCache.enabled true 是否启用RequestScope的缓存
hystrix.command.default/ hystrix.command.HystrixCommandKey requestLog.enabled true 是否记录执行的细节日志
Collapser Properties maxRequestsInBatch Integer.MAX_VALUE 一批的最大请求树
hystrix.collapser.default/ hystrix.collapser.HystrixCollapserKey timerDelayInMilliseconds 10 批量处理收集请求的时间窗口
requestCache.enabled true 启用requestscope缓存,同Command缓存,配置前缀为hystrix.collapser.XXX
ThreadPool Properties coreSize 10 核心线程数
hystrix.threadpool.default/ hystrix.threadpool.HystrixThreadPoolKey maximumSize 10 最大线程数
maxQueueSize -1 等待队列最大长度
queueSizeRejectionThreshold 5 动态调整等待队列大小
keepAliveTimeMinutes 1 空闲线程回收时间
allowMaximumSizeToDivergeFromCoreSize false 设为true之后最大线程数和核心线程数可以设不同的值
metrics.rollingStats.timeInMilliseconds 10000 线程池统计时间窗口
metrics.rollingStats.numBuckets 10 线程池统计滑动窗口数

详解

其他

上一篇 下一篇

猜你喜欢

热点阅读