【问题标题】:Spring Zuul - Gateway TimeoutSpring Zuul - 网关超时
【发布时间】:2016-09-10 05:12:58
【问题描述】:

我看到一个使用 Spring Cloud Zuul 网关模式的长请求的 504 响应。发出请求后正好 1 分钟发生超时。

我尝试了以下方法无济于事:

zuul:
  ribbon:
    ConnectTimeout: 10000000
    ReadTimeout: 10000000

和:

hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 10000000

hystrix:
  command:
    default:
      execution:
        timeout:
          enabled: false

这些都不能防止网关在一分钟后超时。

【问题讨论】:

    标签: java spring netflix-zuul


    【解决方案1】:

    原来是 AWS Elastic Load Balancer 的空闲超时值。我将空闲超时时间增加到 3 分钟,问题就消失了。

    【讨论】:

    • 刚刚花了很多时间经历同样的事情。在 zuul 上有非常高的功能区和 hystrix 超时,并且总是在 60 公里处获得 504 GATEWAY_TIMEOUT。碰撞 ELB 空闲超时修复了它。
    • 碰撞这个的语法/属性是什么?
    【解决方案2】:

    试试这个不同的配置:

    # Disable Hystrix timeout globally (for all services)
    #hystrix.command.default.execution.timeout.enabled: false
    
    # Disable Hystrix timeout for a single service
    #hystrix.command.<serviceName>.execution.timeout.enabled: false
    
    # Increase the Hystrix timeout to 60s (globally)
    #hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 60000
    
    # Increase the Hystrix timeout to 60s (per service)
    #hystrix.command.<serviceName>.execution.isolation.thread.timeoutInMilliseconds: 60000
    

    【讨论】:

    • 感谢您的回答,间接帮助我找到了根本原因。
    • 今天仍然可以使用 spring boot 2 吗?我读到有些属性发生了变化。
    猜你喜欢
    • 2021-05-01
    • 2017-07-27
    • 2018-01-23
    • 2020-04-28
    • 2016-12-20
    • 2018-10-13
    • 2019-07-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多