环境
openjdk:10.0.1-jre-slim对接问题
我有一个名为serviceA的丝带客户端
serviceA.ribbon.ConnectTimeout=5000
serviceA.ribbon.ReadTimeout=15000
hystrix.command.serviceA.execution.isolation.thread.timeoutInMilliseconds = 20000我没有(故意)在类路径上进行弹簧重试.我执行./mvnw dependency:list | grep -i retry,没有得到任何结果。
在运行时,我会收到以下警告:
命令serviceA的20000ms的Hystrix设置的值低于条带读取和连接超时(400000 is )的组合。
我不知道这些数字是从哪里来的,因为我想把它们分别设为15秒和5秒。为什么这个数字是两倍?
发布于 2018-06-05 06:03:22
实际上,丝带超时包括所有相同的服务器重试和下一个服务器重试。
ribbonTimeout = (ribbon.ConnectTimeout + ribbon.ReadTimeout) * (ribbon.MaxAutoRetries + 1) * (ribbon.MaxAutoRetriesNextServer + 1);
// ...
if(hystrixTimeout < ribbonTimeout) {
        LOGGER.warn("The Hystrix timeout of " + hystrixTimeout + "ms for the command " + commandKey +
            " is set lower than the combination of the Ribbon read and connect timeout, " + ribbonTimeout + "ms.");
    }在您的配置中:
因此,hystrixTimeout应该是:
(5000 + 15000) * (1 + 0) * (1 + 1) // -> 40000 ms如果您选择不配置Hystrix超时,默认的Hystrix超时将是40000ms。
19.13 Spring文档中的Zuul超时
https://stackoverflow.com/questions/50622668
复制相似问题