我正在尝试使用Hystrix Collapser命令。我的命令将一个数字列表作为输入,进行网络调用并返回结果。如果输入列表大小小于5,则collapser命令执行正常,我将返回结果。如果输入大小增加,让我们说50,我得到上述异常,比如在执行第10或第12个请求之后。这是hystrix属性的setter。 collapser属性非常默认并请求作用域。
Setter.withGroupKey(HystrixCommandGroupKey.Factory
.asKey("GroupKey"))
.andCommandKey(HystrixCommandKey.Factory
.asKey("CommandKey"))
.andThreadPoolKey(
HystrixThreadPoolKey.Factory.asKey("MyPool"))
.andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter().withCoreSize(15)
.withMaxQueueSize(50).withQueueSizeRejectionThreshold(50))
.andCommandPropertiesDefaults(
HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(6000)
.withFallbackEnabled(false).withExecutionIsolationThreadInterruptOnTimeout(false))
请帮我理解配置缺少什么? 样本堆栈跟踪
2018-01-09 19:17:54,347 [HystrixTimer-2] [] [] [] [] [] (com.netflix.hystrix.util.HystrixTimer) ERROR - Failed while ticking TimerListener
java.lang.RuntimeException: rx.exceptions.OnErrorNotImplementedException: CommandKey timed-out and fallback disabled.
at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.run(HystrixContextRunnable.java:59)
at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator$2.tick(AbstractCommand.java:976)
at com.netflix.hystrix.util.HystrixTimer$1.run(HystrixTimer.java:100)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:0)
我相信你缺少配置
https://github.com/Netflix/Hystrix/issues/1554
- coreSize:ExecutorService的最小工作线程数 保持活力
- maximumSize:最大工作线程数 ExecutorService可以使用。这受到系统容量的限制 如果违反,会导致系统崩溃。
- maxQueueSize:最大值 ExecutorService可以承载的Runnable任务的数量。
此外,我没有看到任何定义的collapser属性:maxRequestsInBatch,timerDelayInMilliseconds ...
Hystix配置文档: https://github.com/Netflix/Hystrix/wiki/Configuration