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

 

posted @ 2017-12-22 11:20  EasonJim  阅读(10039)  评论(0编辑  收藏  举报