hystrix(4) properties配置
这一节我们来讲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配置的更多相关文章
- 服务容错保护断路器Hystrix之五:配置
接着<服务容错保护断路器Hystrix之二:Hystrix工作流程解析>中的<2.8.关于配置>再列举重要的配置如下 一.hystrix在生产中的建议 1.保持timeout的 ...
- java Properties 配置信息类
Properties(配置信息类):主要用于生产配置文件和读取配置文件信息. ----> 是一个集合类 继承HashTable 存值是以键-值的方式. package com.beiwo.io; ...
- 玩转spring boot——properties配置
前言 在以往的java开发中,程序员最怕大量的配置,是因为配置一多就不好统一管理,经常出现找不到配置的情况.而项目中,从开发测试环境到生产环境,往往需要切换不同的配置,如测试数据库连接换成生产数据库连 ...
- Quartzs -- Quartz.properties 配置
Quartzs -- Quartz.properties 配置 文件加载位置 默认:优先顺序 Classpath:quartz.properties --> org/quartz/quartz. ...
- Hibernate4搭建Log4J日志管理(附Log4j.properties配置详解)
1.首先加入slf4j的jar包,即slf4j-api-1.6.1.jar 在hibernate官网下载hibernate-release-4.2.2.Final.zip并解压,在hibernate- ...
- Log4j.properties配置详细解读
Log4j.properties配置 Log4j有三个主要的组件:Loggers(记录器),Appenders (输出源)和Layouts(布局).这里可简单理解为日志类别,日志要输出的地方和日志以 ...
- 【spring boot】SpringBoot初学(2) - properties配置和读取
前言 只是简单的properties配置学习,修改部分"约定"改为自定义"配置".真正使用和遇到问题是在细看. 一.主要 核心只是demo中的: @Proper ...
- Spring Boot Dubbo applications.properties 配置清单
摘要: 原创出处 www.bysocket.com 「泥瓦匠BYSocket 」欢迎转载,保留摘要,谢谢! 『 与其纠结,不如行动学习.Innovate ,And out execute ! 』 本文 ...
- log4j.properties配置详解与实例
log4j.properties配置详解与实例 第一步:加入log4j-1.x.x.jar到lib下. 第二步:在工程的src下下建立log4j.properties.内容如下: #OFF,syste ...
随机推荐
- Url跳转漏洞常见
Url跳转漏洞常见出现点: 1.用户登录.统一身份认证处,认证完后会跳转. 2.用户分享.收藏内容过后,会跳转. 3.跨站点认证.授权后,会跳转. 4.站内点击其它网址链接时,会跳转. Url跳转漏洞 ...
- 初入Shell
shell 第1章 Shell概述 大数据程序员为什么要学习Shell呢? 1)需要看懂运维人员编写的Shell程序. 2)偶尔会编写一些简单Shell程序来管理集群.提高开发效率. 第2章 Shel ...
- kernel 通知链
原文链接: 深入理解linux网络技术内幕读书笔记(四)--通知链 概述 [注意] 通知链只在内核子系统之间使用. 大多数内核子系统都是相互独立的,因此某个子系统可能对其它子系统产生的事件感兴趣.为了 ...
- 如何寻找决策最优解?熵权TOPSIS助你科学决策
熵权topsis是一种融合了熵值法与TOPSIS法的综合评价方法.熵值法是一种客观赋值法,可以减少主观赋值带来的偏差:而topsis法是一种常见的多目标决策分析方法,适用于多方案.多对象的对比研究,从 ...
- C++奇淫技巧
一.关于:的妙用 如下代码 #include<cstdio> #include<iostream> typedef struct point{ int a; int b; po ...
- 从 BIO、NIO 聊到 Netty,最后还要实现个 RPC 框架!
大家好,我是 「后端技术进阶」 作者,一个热爱技术的少年. 觉得不错的话,欢迎 star!ღ( ´・ᴗ・` )比心 Netty 从入门到实战系列文章地址:https://github.com/Snai ...
- DAO层,Service层,Controller层、View层、entity层
1.DAO(mapper)层:DAO层主要是做数据持久层的工作,负责与数据库进行联络的一些任务都封装在此,DAO层的设计首先是设计DAO的接口,然后在Spring的配置文件中定义此接口的实现类,然后就 ...
- IDEA报错:Class JavaLaunchHelper is implemented in both
在IDEA运行一个程序时报错: Class JavaLaunchHelper is implemented in both 这个错误是Mac下Java 的一个bug,意思是这个JavaLaunchHe ...
- JavaScript基础语法资料
JavaScript基础第01天 1 - 编程语言 1.1 编程 编程: 就是让计算机为解决某个问题而使用某种程序设计语言编写程序代码,并最终得到结果的过程. 计算机程序: 就是计算机所执行的一系列的 ...
- 力扣Leetcode 200. 岛屿数量
岛屿数量 给你一个由 '1'(陆地)和 '0'(水)组成的的二维网格,请你计算网格中岛屿的数量. 岛屿总是被水包围,并且每座岛屿只能由水平方向和/或竖直方向上相邻的陆地连接形成. 此外,你可以假设该网 ...