Hystrix執行緒池配置
阿新 • • 發佈:2019-01-04
斷路器: hystrix.command.default.circuitBreaker.requestVolumeThreshold(當在配置時間視窗內達到此數量的失敗後,進行短路。預設20個) #For example, if the value is 20, then if only 19 requests are received in the rolling window (say a window of 10 seconds) the circuit will not trip open even if all 19 failed. hystrix.command.default.circuitBreaker.sleepWindowInMilliseconds(短路多久以後開始嘗試是否恢復,預設5s) hystrix.command.default.circuitBreaker.errorThresholdPercentage(出錯百分比閾值,當達到此閾值後,開始短路。預設50%) fallback: hystrix.command.default.fallback.isolation.semaphore.maxConcurrentRequests(呼叫執行緒允許請求HystrixCommand.GetFallback()的最大數量,預設10。超出時將會有異常丟擲,注意:該項配置對於THREAD隔離模式也起作用) #Hystrix執行緒池配置 hystrix: # 在呼叫方配置,被該呼叫方的指定方法(HystrixCommandKey方法名)的超時時間是該值 command: findById: #方法名(HystrixCommandKey) execution: isolation: thread: timeoutInMilliseconds: 30000 default: circuitBreaker: # 當在配置時間視窗內達到此數量的失敗後,進行短路。預設20個;For example, if the value is 20, then if only 19 requests are received in the rolling window (say a window of 10 seconds) the circuit will not trip open even if all 19 failed. requestVolumeThreshold: 20 sleepWindowInMilliseconds: 50000 #短路5秒鐘,嘗試恢復 errorThresholdPercentage: #出錯百分比閾值 # 執行緒池核心執行緒數 threadpool: default: coreSize: 15 # 最大排隊長度。預設-1,使用SynchronousQueue。其他值則使用 LinkedBlockingQueue。如果要從-1換成其他值則需重啟,即該值不能動態調整,若要動態調整,需要使用到下邊這個配置 maxQueueSize: -1 # 排隊執行緒數量閾值,預設為5,達到時拒絕,如果配置了該選項,佇列的大小是該佇列 queueSizeRejectionThreshold: