Project scenario:
Feedback from colleagues during stress testing only supports 10 concurrent users
Problem Description
通过查看日志,可以看到一下关键报错信息:
could not be queued for execution and no fallback available.
Cause Analysis:
Hystrix默认是10个线程,超过就会报这个异常(线程池的拒绝策略)
solution:
Modify the Hystrix configuration, the problem is solved, as follows:
hystrix:
threadpool:
default:
coreSize: 200 # 并发执行的最大线程数,默认10
maxQueueSize: 200 # BlockingQueue的最大队列数
queueSizeRejectionThreshold: 50 # 即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
execution:
timeout:
enabled: true
isolation:
strategy: THREAD
semaphore:
maxConcurrentRequests: 1000
thread:
timeoutInMilliseconds: 30000