Zuul API Gateway Timeout Error

If a requested Microservice takes long time to respond, Zuul Api Gateway might timeout and a Gateway timeout error will take place.

    "timestamp": "2019-05-24T00:53:22.152+0000",
    "status": 504,
    "error": "Gateway Timeout",
    "message": "com.netflix.zuul.exception.ZuulException: Hystrix Readed time out"

In this short blog post I am going to share with you how to make your Zuul Api Gateway not to timeout.

Ribbon Read Timeout Property

In most cases setting ribbon.ReadTimeout property will solve the problem.

Add the following property to an application.properties file of your Zuul Api Gateway and restart your application.


Note: The value is provided in milliseconds and that the property name is case-sensitive. It will not work if you type it otherwise.

Other Connection Timeout Related Properties

There are other connection related configuration that you might want to check to make sure their value is not the cause of an error in your case.

  • ribbon.ConnectTimeout – The connection timeout in milliseconds. Defaults to 1000,
  • zuul.host.connect-timeout-millis – The connection timeout in milliseconds. Defaults to 2000,
  • zuul.host.socket-timeout-millis – The socket timeout in millis. Defaults to 10000.
  • zuul.host.max-per-route-connections – The maximum number of connections that can be used by a single route. Default: 20
  • zuul.host.max-total-connections – The maximum number of total connections the proxy can hold open to backends. Default: 200.
  • zuul.host.time-to-live – The lifetime for the connection pool. Default: -1.

I hope this will help you to resolve an issue with Zuul API Gateway Timeout error.

If you are interested to learn more about Spring Cloud and Microservices have a look at Spring Cloud tutorials.  And if you enjoy learning by watching video lessons then have a look at the below list of online video courses that teach Microservices and Spring Cloud.

Leave a Reply

Your email address will not be published. Required fields are marked *