zoukankan      html  css  js  c++  java
  • 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。

  • 相关阅读:
    最短路径问题
    这是我的第一篇博客
    Time Series Anomaly Detection
    R-CNN, Fast R-CNN, Faster R-CNN, Mask R-CNN
    database 学习
    AWS Cloud Practioner 官方课程笔记
    Cassandra commands
    go 语言学习
    [Udemy] ES 7 and Elastic Stack
    第9章 内联函数
  • 原文地址:https://www.cnblogs.com/zhangwanhua/p/10037401.html
Copyright © 2011-2022 走看看