Dav*_*vid 2 hystrix spring-cloud spring-cloud-feign netflix-ribbon spring-cloud-netflix
openjdk:10.0.1-jre-slim我有一个名为serviceA并关联的功能区客户端
serviceA.ribbon.ConnectTimeout=5000
serviceA.ribbon.ReadTimeout=15000
hystrix.command.serviceA.execution.isolation.thread.timeoutInMilliseconds = 20000
Run Code Online (Sandbox Code Playgroud)
我还没有(知道)在类路径上进行spring-retry。我执行./mvnw dependency:list | grep -i retry并没有结果。
在运行时,我收到以下警告:
命令serviceA的Hystrix超时20000ms设置为小于功能区读取和连接超时的组合40000ms。
考虑到我认为分别将它们设置为15秒和5秒,因此我不确定这些数字来自何处。为什么这个数字翻倍?
boo*_*oon 11
实际上,功能区超时包括所有相同的服务器重试和下一个服务器重试。
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.");
}
Run Code Online (Sandbox Code Playgroud)
在您的配置中:
因此hystrixTimeout应该是:
(5000 + 15000) * (1 + 0) * (1 + 1) // -> 40000 ms
Run Code Online (Sandbox Code Playgroud)
如果您选择不配置Hystrix超时,则默认的Hystrix超时将为40000ms。
| 归档时间: |
|
| 查看次数: |
4677 次 |
| 最近记录: |