hystrix参数详解
hystrix.command.default
和hystrix.threadpool.default
中的default
为默认CommandKey
Execution相关的属性的配置:
hystrix.command.default.execution.isolation.strategy
-----隔离策略,默认是Thread
, 可选Thread
|Semaphore
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
------命令执行超时时间,默认1000ms
hystrix.command.default.execution.timeout.enabled
-----执行是否启用超时,默认启用true
hystrix.command.default.execution.isolation.thread.interruptOnTimeout
----- 发生超时是是否中断,默true
hystrix.command.default.execution.isolation.semaphore.maxConcurrentRequests
----- 最大并发请求数,默认10,该参数当使用ExecutionIsolationStrategy.SEMAPHORE
策略时才有效。如果达到最大并发请求数,请求会被拒绝。理论上选择semaphore size
的原则和选择thread size
一致,但选用semaphore
时每次执行的单元要比较小且执行速度快(ms级别),否则的话应该用thread
。semaphore应该占整个容器(tomcat)的线程池的一小部分。
Fallback相关的属性:
- 这些参数可以应用于
Hystrix的THREAD
和SEMAPHORE
策略 hystrix.command.default.fallback.isolation.semaphore.maxConcurrentRequests
----如果并发数达到该设置值,请求会被拒绝和抛出异常并且fallback不会被调用。默认10hystrix.command.default.fallback.enabled
----当执行失败或者请求被拒绝,是否会尝试调用hystrixCommand.getFallback()
。默认true
Circuit Breaker相关的属性:
hystrix.command.default.circuitBreaker.enabled
----用来跟踪circuit的健康性,如果未达标则让request短路。默认true
hystrix.command.default.circuitBreaker.requestVolumeThreshold
----一个rolling window内最小的请求数。如果设为20,那么当一个rolling window的时间内(比如说1个rolling window是10秒)收到19个请求,即使19个请求都失败,也不会触发circuit break。默认20hystrix.command.default.circuitBreaker.sleepWindowInMilliseconds
----触发短路的时间值,当该值设为5000时,则当触发circuit break
后的5000毫秒内都会拒绝request,也就是5000毫秒后才会关闭circuit。默认5000
hystrix.command.default.circuitBreaker.errorThresholdPercentage
----错误比率阀值,如果错误率>=该值,circuit会被打开,并短路所有请求触发fallback。默认50hystrix.command.default.circuitBreaker.forceOpen
----强制打开熔断器,如果打开这个开关,那么拒绝所有request,默认false
hystrix.command.default.circuitBreaker.forceClosed
----强制关闭熔断器 如果这个开关打开,circuit将一直关闭且忽略circuitBreaker.errorThresholdPercentage
Metrics相关参数
hystrix.command.default.metrics.rollingStats.timeInMilliseconds
----设置统计的时间窗口值的,毫秒值,circuit break 的打开会根据1个rolling window的统计来计算。若rolling window被设为10000毫秒,则rolling window会被分成n个buckets,每个bucket包含success,failure,timeout,rejection的次数的统计信息。默认10000hystrix.command.default.metrics.rollingStats.numBuckets
----设置一个rolling window被划分的数量,若numBuckets=10,rolling window=10000,那么一个bucket的时间即1秒。必须符合rolling window % numberBuckets == 0。默认10hystrix.command.default.metrics.rollingPercentile.enabled
---- 执行时是否enable指标的计算和跟踪,默认truehystrix.command.default.metrics.rollingPercentile.timeInMilliseconds
---- 设置rolling percentile window的时间,默认60000hystrix.command.default.metrics.rollingPercentile.numBuckets
---- 设置rolling percentile window的numberBuckets。逻辑同上。默认6hystrix.command.default.metrics.rollingPercentile.bucketSize
---- 如果bucket size=100,window=10s,若这10s里有500次执行,只有最后100次执行会被统计到bucket里去。增加该值会增加内存开销以及排序的开销。默认100hystrix.command.default.metrics.healthSnapshot.intervalInMilliseconds
---- 记录health 快照(用来统计成功和错误绿)的间隔,默认500ms
Request Context 相关参数
hystrix.command.default.requestCache.enabled
---- 默认true,需要重载getCacheKey(),返回null时不缓存hystrix.command.default.requestLog.enabled
----记录日志到HystrixRequestLog,默认true
Collapser Properties 相关参数
hystrix.collapser.default.maxRequestsInBatch
---- 单次批处理的最大请求数,达到该数量触发批处理,默认Integer.MAX_VALUEhystrix.collapser.default.timerDelayInMilliseconds
---- 触发批处理的延迟,也可以为创建批处理的时间+该值,默认10hystrix.collapser.default.requestCache.enabled
----是否对HystrixCollapser.execute() and HystrixCollapser.queue()的cache,默认true
ThreadPool 相关参数
- 线程数默认值10适用于大部分情况(有时可以设置得更小),如果需要设置得更大,那有个基本得公式可以计算:
- requests per second at peak when healthy × 99th percentile latency in seconds + some breathing room
- 每秒最大支撑的请求数 (99%平均响应时间 + 缓存值)
- 比如:每秒能处理1000个请求,99%的请求响应时间是60ms,那么公式是:
0.060+0.012
基本得原则是保持线程池尽可能小,主要是为了释放压力,防止资源被阻塞。当一切都是正常的时候,线程池一般仅会有1到2个线程激活来提供服务
hystrix.threadpool.default.coreSize
---- 并发执行的最大线程数,默认10hystrix.threadpool.default.maxQueueSize
----BlockingQueue``的最大队列数,当设为-1,会使用SynchronousQueue
,值为正时使用LinkedBlcokingQueue``。该设置只会在初始化时有效,之后不能修改threadpool
的queue size
,除非reinitialising thread executor
。默认-1。hystrix.threadpool.default.queueSizeRejectionThreshold
---- 排队线程数量阈值,默认为5,达到时拒绝,如果配置了该选项,队列的大小是该队列。注意:如果maxQueueSize=-1的话,则该选项不起作用。hystrix.threadpool.default.keepAliveTimeMinutes
---- 如果corePoolSize
和maxPoolSize
设成一样(默认实现)该设置无效。如果通过plugin(https://github.com/Netflix/Hystrix/wiki/Plugins)
使用自定义实现,该设置才有用,默认1.hystrix.threadpool.default.metrics.rollingStats.timeInMilliseconds
---- 线程池统计指标的时间,默认10000hystrix.threadpool.default.metrics.rollingStats.numBuckets
---- 将rolling window划分为n个buckets,默认10
hystrix参数详解的更多相关文章
- Nginx主配置参数详解,Nginx配置网站
1.Niginx主配置文件参数详解 a.上面博客说了在Linux中安装nginx.博文地址为:http://www.cnblogs.com/hanyinglong/p/5102141.html b.当 ...
- iptables参数详解
iptables参数详解 搬运工:尹正杰 注:此片文章来源于linux社区. Iptalbes 是用来设置.维护和检查Linux内核的IP包过滤规则的. 可以定义不同的表,每个表都包含几个内部的链,也 ...
- chattr的常用参数详解
chattr的常用参数详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 在实际生产环境中,有的运维工程师不得不和开发和测试打交道,在我们公司最常见的就是部署接口.每天每个人部署的 ...
- mha配置参数详解
mha配置参数详解: 参数名字 是否必须 参数作用域 默认值 示例 hostname Yes Local Only - hostname=mysql_server1, hostname=192.168 ...
- $.ajax()方法所有参数详解;$.get(),$.post(),$.getJSON(),$.ajax()详解
[一]$.ajax()所有参数详解 url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. type: 要求为String类型的参数,请求方式(post或get)默认为get.注 ...
- linux PHP 编译安装参数详解
linux PHP 编译安装参数详解 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc -- ...
- 【转】jqGrid 各种参数 详解
[原文]http://www.cnblogs.com/younggun/archive/2012/08/27/2657922.htmljqGrid 各种参数 详解 JQGrid JQGrid是一个 ...
- HTML滚动字幕代码参数详解及Js间隔滚动代码
html文字滚动代码 <marquee style="WIDTH: 388px; HEIGHT: 200px" scrollamount="2" dire ...
- mysql5.6主从参数详解
mysql5.6的主从相当的不错,增加了不少参数,提升了主从同步的安全和效率,以下是mysql5.6主从参数详解. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ...
随机推荐
- 踩坑之VC报错 error RC2104 : undefined keyword or key name
.RC文件中第541行 MENUITEM "CNDev, ID_CNDEV 少了一个" 正确的应该是MENUITEM " ...
- 03-自己封装DateUtil工具类
package com.utils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.u ...
- 基于Python的设计模式简述
结构梳理>>> 第一部分: 创建型模式 工厂模式 工厂方法 抽象工厂 建造者模式 原型模式 单例模式 第二部分: 结构型模式 适配器模式 修饰器模式 外观模式 享元模式 模型-视图- ...
- idea基本使用1
首先推荐两个快捷键 alt+Ent 相当于eclipse中的crtl+1 alt+ins :能创建包,类等,还能生成getter,setter,和构造函数 首先创建一个w ...
- Unity Post-Processing的一些分享
讲些什么? 绝大多数的游戏或多或少都会使用些后处理效果. 早期版本中,Unity在提供的接口有限,优化空间不大,属于放任自流.官方推出了Post-Processing(下文简称PP)并在Github上 ...
- redis哨兵架构的基础知识及部署和管理
一.前言 1.哨兵的介绍 sentinal,中文名是哨兵 哨兵是redis集群架构中非常重要的一个组件,主要功能如下 ()集群监控,负责监控redis master和slave进程是否正常工作 ()消 ...
- localStorage sessionStorage 用法
sessionStorage.getItem('key') // 获取 sessionStorage.setItem('key','value') //设置 sessionStorage.remove ...
- Lua学习之加载其他lua文件
Lua 中提供了模块的概念,模块类似一个封装库或者 C++ 中的一个类,可以将公用的部分提到一个文件中,以 API 的形式供其他 lua 文件调用. Lua 中的模块其实就是包含变量.函数等已知元素组 ...
- 关于学习CentOS7使用firewalld打开关闭防火墙和端口
1.firewalld简介 firewalld是centos7的一大特点,主要有两个优点:一是支持动态更新,不需要重启服务:二就是加入了防火墙的“zone”概念. firewalld有图形界面和工具界 ...
- 读取tensorflow的checkpoint里保存的参数
import tensorflow as tf from tensorflow.python import pywrap_tensorflow import os checkpoint_path = ...