解决:The Hystrix timeout of ***ms for the command *** is set lower than the combination of the Ribbon

 

项目具体报错如下:

2019-09-19 17:46:48.283 [http-nio-7777-exec-3] WARN  o.s.c.n.z.f.route.support.AbstractRibbonCommand - The Hystrix timeout of 5000ms for the command SERVICE is set lower than the combination of the Ribbon read and connect timeout, 400000ms.

分析:

hystrix超时设置:

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds = 6000  # 默认超时时间
hystrix.command.xxx.execution.isolation.thread.timeoutInMilliseconds = 6000      # 具体应用的超时时间
Ribbon 总时间ribbonTimeout = (ribbonReadTimeout + ribbonConnectTimeout) * (maxAutoRetries + 1) * (maxAutoRetriesNextServer + 1);
笔者这里的具体值为:(5000+5000)*(1+1)*(1+1)=40000;

而Hystrix 时间为:5000,具体办法也好办,在配置文件中修改超时为:
hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 40000

 或者修改ribbon配置:

AUSERVICE:  #这是ribion要请求的serviceID
  ribbon:
    ReadTimeout: 2000
    ConnectTimeout: 2000
    MaxAutoRetries: 0
    MaxAutoRetriesNextServer: 0

即:(2000+2000)*(0+1)*(0+1)=4000<5000也可。

ribbon全局设置,超时时间:(2000+1000)*(0+1)*(1+1)=6000:

ribbon.ReadTimeout = 2000            # 访问超时,单位毫秒,默认1000
ribbon.ConnectTimeout = 1000         # 连接超时,单位毫秒,默认1000
ribbon.MaxAutoRetries = 0            # 最大重试次数,默认0
ribbon.MaxAutoRetriesNextServer = 1  # 最大重试服务个数,默认1

 

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值