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

项目具体报错如下:

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.

分析:

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也可。

posted @   Shapley  阅读(10428)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
历史上的今天:
2012-09-19 我眼中的异步【YY版】
点击右上角即可分享
微信分享提示