官方文檔:
https://github.com/Netflix/Hystrix/wiki/Configuration
1)execution.isolation.strategy 隔離策略
THREAD 線程池 (默認) 它在單獨的線程上執行,並發請求受線程池中線程數的限制
SEMAPHORE 信號量 它在調用線程上執行,並發請求受信號量限制
2)execution.isolation.thread.timeoutInMilliseconds 超時時間 (默認1000毫秒)
3)execution.timeout.enabled 是否開啟超時限制 (推薦開啟)
4)execution.isolation.semaphore.maxConcurrentRequests
隔離策略為信號量時,如果達到最大並發數時,后續請求會被拒絕,默認是10
舉例:
#hystrix熔斷超時配置
hystrix:
command:
default:
execution:
#開啟超時配置(默認為開啟)
timeout:
enabled: true
#設置超時時間
isolation:
thread:
timeoutInMilliseconds: 4000