Hystrix命令失败,并且“超时且无可用回退”。 [英] Hystrix command fails with "timed-out and no fallback available"
问题描述
我注意到我的应用程序中的某些命令失败了
I've noticed that some of the commands in my application fail with
Caused by: ! com.netflix.hystrix.exception.HystrixRuntimeException: GetAPICommand timed-out and no fallback available.
out: ! at com.netflix.hystrix.HystrixCommand.getFallbackOrThrowException(HystrixCommand.java:1631)
out: ! at com.netflix.hystrix.HystrixCommand.access$2000(HystrixCommand.java:97)
out: ! at com.netflix.hystrix.HystrixCommand$TimeoutObservable$1$1.tick(HystrixCommand.java:1025)
out: ! at com.netflix.hystrix.HystrixCommand$1.performBlockingGetWithTimeout(HystrixCommand.java:621)
out: ! at com.netflix.hystrix.HystrixCommand$1.get(HystrixCommand.java:516)
out: ! at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:425)
out: Caused by: ! java.util.concurrent.TimeoutException: null
out: !... 11 common frames omitted
这是我的Hystrix配置覆盖:
This is my Hystrix configuration override:
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=210000
hystrix.threadpool.default.coreSize=50
hystrix.threadpool.default.maxQueueSize=100
hystrix.threadpool.default.queueSizeRejectionThreshold=50
这是什么类型的超时?它是外部应用程序的读/连接超时吗?我该如何调试呢?
What kind of timeout is this? Is it a read/connection timeout to the external application? How do I go about debugging this?
推荐答案
这是一个Hystrix命令超时,默认情况下每个命令启用此超时,使用属性定义值:
This is a Hystrix Command Timeout, this timeout is enabled by default per each command, you define the value using the property:
execution.isolation.thread.timeoutInMilliseconds:
property设置以毫秒为单位的时间,在此之后调用者将
观察到超时并离开命令执行。 Hystrix将HystrixCommand标记为TIMEOUT,并执行回退逻辑。
execution.isolation.thread.timeoutInMilliseconds: This property sets the time in milliseconds after which the caller will observe a timeout and walk away from the command execution. Hystrix marks > the HystrixCommand as a TIMEOUT, and performs fallback logic.
因此,您可以增加超时值或禁用默认超时(如果适用于您的情况)使用属性的命令:
So you can increase your timeout value or disable the default time out (if apply in your case) for your command using the property:
@HystrixProperty(name =hystrix.command.default.execution.timeout .enabled,value =false)
您可以在此处找到更多信息: https://github.com/Netflix/Hystrix/wiki/Configuration#CommandExecution
You can find more information here: https://github.com/Netflix/Hystrix/wiki/Configuration#CommandExecution
这篇关于Hystrix命令失败,并且“超时且无可用回退”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!