这一节我们来讲hystrix的properties配置体系,properties配置也是各个功能模块的基础功能。hystrix将配置分成三个部分:

  1.HystrixCommandProperties用于HystrixCommand配置,一个HystrixCommandKey对应一个HystrixCommandProperties实例。

  2.HystrixThreadPoolProperties用于HystrixThreadPool配置,一个HystrixThreadPoolKey对应一个HystrixThreadPoolProperties实例。

  3.HystrixCollapserProperties用于HystrixCollapserCommand配置,一个HystrixCollapserKey对应一个HystrixCollapserProperties实例。

类别 配置项 默认值 说明
HystrixCommandProperties                       

hystrix.threadpool.[commandkey].circuitBreaker.enabled

true  
hystrix.threadpool.[commandkey].circuitBreaker.requestVolumeThreshold 20  
hystrix.threadpool.[commandkey].circuitBreaker.sleepWindowInMilliseconds 5000  
hystrix.threadpool.[commandkey].circuitBreaker.errorThresholdPercentage 50  
hystrix.threadpool.[commandkey].circuitBreaker.forceOpen false  
hystrix.threadpool.[commandkey].circuitBreaker.forceClosed false  
hystrix.threadpool.[commandkey].execution.isolation.strategy Thread  
hystrix.threadpool.[commandkey].execution.isolation.thread.timeoutInMilliseconds 1000  
hystrix.threadpool.[commandkey].execution.timeout.enabled true  
hystrix.threadpool.[commandkey].execution.isolation.thread.interruptOnTimeout true  
hystrix.threadpool.[commandkey].execution.isolation.thread.interruptOnFutureCancel false  
hystrix.threadpool.[commandkey].execution.isolation.semaphore.maxConcurrentRequests 10  
hystrix.threadpool.[commandkey].fallback.isolation.semaphore.maxConcurrentRequests 10  
hystrix.threadpool.[commandkey].fallback.enabled true  
hystrix.threadpool.[commandkey].metrics.rollingStats.timeInMilliseconds 10000  
hystrix.threadpool.[commandkey].metrics.rollingStats.numBuckets 10  
hystrix.threadpool.[commandkey].metrics.rollingPercentile.enabled true  
hystrix.threadpool.[commandkey].metrics.rollingPercentile.timeInMilliseconds 60000  
hystrix.threadpool.[commandkey].metrics.rollingPercentile.numBuckets 6  
hystrix.threadpool.[commandkey].metrics.rollingPercentile.bucketSize 100  
hystrix.threadpool.[commandkey].metrics.healthSnapshot.intervalInMilliseconds 500  
hystrix.threadpool.[commandkey].requestCache.enabled true  
hystrix.threadpool.[commandkey].requestLog.enabled true  
hystrix.threadpool.[commandkey].threadPoolKeyOverride    
HystrixThreadPoolProperties hystrix.threadpool.[threadPoolkey].coreSize 10  
hystrix.threadpool.[threadPoolkey].allowMaximumSizeToDivergeFromCoreSize false  
hystrix.threadpool.[threadPoolkey].maximumSize 10  
hystrix.threadpool.[threadPoolkey].keepAliveTimeMinutes 1  
hystrix.threadpool.[threadPoolkey].maxQueueSize -1  
hystrix.threadpool.[threadPoolkey].queueSizeRejectionThreshold 5  
hystrix.threadpool.[threadPoolkey].metrics.rollingStats.timeInMilliseconds 10000  
hystrix.threadpool.[threadPoolkey].metrics.rollingStats.numBuckets 10  
HystrixCollapserProperties hystrix.collapser.[collapserCommandkey].maxRequestsInBatch Integer.MAX_VALUE  
hystrix.collapser.[collapserCommandkey].timerDelayInMilliseconds 10  
hystrix.collapser.[collapserCommandkey].requestCache.enabled true  
hystrix.collapser.[collapserCommandkey].metrics.rollingStats.timeInMilliseconds 10000  
hystrix.collapser.[collapserCommandkey].metrics.rollingStats.numBuckets 10  
hystrix.collapser.[collapserCommandkey].metrics.rollingPercentile.enabled true  
hystrix.collapser.[collapserCommandkey].metrics.rollingPercentile.timeInMilliseconds 60000  
hystrix.collapser.[collapserCommandkey].metrics.rollingPercentile.numBuckets 6  
hystrix.collapser.[collapserCommandkey].metrics.rollingPercentile.bucketSize 100  

  内部每个属性由一个ChainHystrixProperty表示,ChainHystrixProperty是一个串联的HystrixDynamicProperty,持续获取串中的属性值,直到获得不为null值为止。ChainHystrixProperty串联的HystrixDynamicProperty默认通过插件获取的HystrixDynamicProperties获取(最后我们会讲到插件)。

  HystrixDynamicProperty表示动态配置数据,如果配置源发送变化,通过该对象获取配置也会相应变化。hystrix中有种实现类:

    1.通过archaius实现获取配置项,通过HystrixDynamicPropertiesArchaius创建该类HystrixDynamicProperty。

    2.通过system实现获取配置项,通过HystrixDynamicPropertiesSystemProperties创建该类HystrixDynamicProperty。

hystrix(4) properties配置的更多相关文章

  1. 服务容错保护断路器Hystrix之五:配置

    接着<服务容错保护断路器Hystrix之二:Hystrix工作流程解析>中的<2.8.关于配置>再列举重要的配置如下 一.hystrix在生产中的建议 1.保持timeout的 ...

  2. java Properties 配置信息类

    Properties(配置信息类):主要用于生产配置文件和读取配置文件信息. ----> 是一个集合类 继承HashTable 存值是以键-值的方式. package com.beiwo.io; ...

  3. 玩转spring boot——properties配置

    前言 在以往的java开发中,程序员最怕大量的配置,是因为配置一多就不好统一管理,经常出现找不到配置的情况.而项目中,从开发测试环境到生产环境,往往需要切换不同的配置,如测试数据库连接换成生产数据库连 ...

  4. Quartzs -- Quartz.properties 配置

    Quartzs -- Quartz.properties 配置 文件加载位置 默认:优先顺序 Classpath:quartz.properties --> org/quartz/quartz. ...

  5. Hibernate4搭建Log4J日志管理(附Log4j.properties配置详解)

    1.首先加入slf4j的jar包,即slf4j-api-1.6.1.jar 在hibernate官网下载hibernate-release-4.2.2.Final.zip并解压,在hibernate- ...

  6. Log4j.properties配置详细解读

    Log4j.properties配置 Log4j有三个主要的组件:Loggers(记录器),Appenders  (输出源)和Layouts(布局).这里可简单理解为日志类别,日志要输出的地方和日志以 ...

  7. 【spring boot】SpringBoot初学(2) - properties配置和读取

    前言 只是简单的properties配置学习,修改部分"约定"改为自定义"配置".真正使用和遇到问题是在细看. 一.主要 核心只是demo中的: @Proper ...

  8. Spring Boot Dubbo applications.properties 配置清单

    摘要: 原创出处 www.bysocket.com 「泥瓦匠BYSocket 」欢迎转载,保留摘要,谢谢! 『 与其纠结,不如行动学习.Innovate ,And out execute ! 』 本文 ...

  9. log4j.properties配置详解与实例

    log4j.properties配置详解与实例 第一步:加入log4j-1.x.x.jar到lib下. 第二步:在工程的src下下建立log4j.properties.内容如下: #OFF,syste ...

随机推荐

  1. JavaScript学习系列博客_22_JavaScript this(上下文对象)

    this(上下文对象) - 我们每次调用函数时,解析器都会将一个上下文对象作为隐含的参数传递进函数. 使用this来引用上下文对象,根据函数的调用形式不同,this代表的对象也不同.不同的情况: 1. ...

  2. SNN对抗攻击笔记

    SNN对抗攻击笔记: 1. 解决SNN对抗攻击中脉冲与梯度数据格式不兼容性以及梯度消失问题: G2S Converter.Gradient Trigger[1] 2. 基于梯度的对抗攻击方式: FGS ...

  3. Java中抽象类和接口的介绍及二者间的区别

    接口(Interface)和抽象类(Abstract Class)是支持抽象类定义的两种机制. 一.抽象类 在Java中被abstract关键字修饰的类称为抽象类,被abstract关键字修饰的方法称 ...

  4. 分布式一致性算法 Paxos、Raft、Zab的区别与联系

    什么是分布式系统? 拿一个最简单的例子,就比如说我们的图书管理系统.之前的系统包含了所有的功能,比如用户注册登录.管理员功能.图书借阅管理等.这叫做集中式系统.也就是一个人干了好几件事. 后来随着功能 ...

  5. asp.net报表结构学习记录

    当一份web报表项目压缩包躺在我的文件夹里时,我是完全懵的.作为一个学习了一个月java的asp.net小白,以前从来没有接触过这方面,我完全不知道从何入手. 手里也有asp.net开发学习视频,但都 ...

  6. java面试题0001-区分类中重载方法的依据是什么?

    到底是根据什么来区分类中重载的方法? A:不同的返回值类型. B:不同的参数类型. C:不同的访问权限. D:不同的参数名称. 解析: Step1.我们先在DifferentiateReload类中创 ...

  7. Java中的判断实例

    .getClass().getName() 这是最常见的一种判断类型的方法 instanceof 用于判断 对象 是否为某个类的实例 Boolean值 各种is方法 isAnnotationPrese ...

  8. Appium框架

    1.通过TestNG单元测试框架管理/执行测试用例 2.TestNG参数化,App启动的四个配置存到Testng.xml中 3.通过page object (PO)设计模式,测试用例和页面元素分离,页 ...

  9. CKA认证经验贴(认证日期:20200817)

    一.背景 由于年初疫情影响,身处传统IT行业且兼职出差全国各地“救火”的我有幸被领导选中调研私有云平台,这就给我后来的认证之路做下了铺垫.之前调研kubernetes的v1.17版本自带kubeadm ...

  10. 1008 Elevator (20 分)(模拟)

    The highest building in our city has only one elevator. A request list is made up with N positive nu ...