Spring Boot中使用Feign調用時Hystrix提示異常:"could not be queued for execution and no fallback available."以及"Rejected command because thread-pool queueSize is at rejection threshold"


說明:

1、我還沒有真正理解Spring Cloud的精髓,現只停留在使用階段,可能存在分析不到位的問題。

1、這個是由於線程池的最大數量導致的,官方說隨着線程池的數量越大,資源開銷也就越大,所以調整時要慎重。

2、Hystrix默認是10個線程,超過就會報這個異常。

解決方法:

hystrix:
  threadpool:
    default:
      coreSize: 200 ##並發執行的最大線程數,默認10
      maxQueueSize: 200 ##BlockingQueue的最大隊列數
      queueSizeRejectionThreshold: 50 ##即使maxQueueSize沒有達到,達到queueSizeRejectionThreshold該值后,請求也會被拒絕
    default:
      execution:
        timeout:
          enabled: true
        isolation:
          strategy: THREAD
          semaphore:
            maxConcurrentRequests: 1000
          thread:
            timeoutInMilliseconds: 30000

說明:以上是YAML寫法

 

參考:

http://blog.csdn.net/gisam/article/details/78028080

http://blog.csdn.net/u011742484/article/details/59524361

http://blog.csdn.net/chenpeng19910926/article/details/78295720?locationNum=2&fps=1

http://blog.csdn.net/w_x_z_/article/details/72222550

http://ju.outofmemory.cn/entry/68192

https://segmentfault.com/a/1190000009939815

http://tietang.wang/2016/02/25/hystrix/Hystrix%E5%8F%82%E6%95%B0%E8%AF%A6%E8%A7%A3/

https://github.com/Netflix/Hystrix/issues/1428

https://github.com/Netflix/Hystrix/wiki/Configuration#allowmaximumsizetodivergefromcoresize

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM